*/
const std::string& preloaded_pt_file() const;
+ /**
+ * @brief Path to policies snapshot file
+ * @return file path
+ */
+ const std::string& policies_snapshot_file_name() const;
+
/*
* @brief Timeout in transport manager before disconnect
*/
std::string app_info_storage_;
int32_t heart_beat_timeout_;
std::string preloaded_pt_file_;
+ std::string policy_shapshot_file_name_;
uint32_t transport_manager_disconnect_timeout_;
bool use_last_state_;
std::vector<uint32_t> supported_diag_modes_;
namespace {
const char* kMainSection = "MAIN";
+const char* kPolicySection = "Policy";
+
+const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json";
// Heartbeat is disabled by default
const uint32_t kDefaultHeartBeatTimeout = 0;
}
list_files_in_none_(5),
app_info_storage_("app_info.dat"),
heart_beat_timeout_(kDefaultHeartBeatTimeout),
+ policy_shapshot_file_name_(kDefaultPoliciesSnapshotFileName),
transport_manager_disconnect_timeout_(0),
use_last_state_(false),
supported_diag_modes_() {
return preloaded_pt_file_;
}
+const std::string&Profile::policies_snapshot_file_name() const{
+ return policy_shapshot_file_name_;
+}
+
uint32_t Profile::transport_manager_disconnect_timeout() const {
return transport_manager_disconnect_timeout_;
}
*value = '\0';
if ((0 != ini_read_value(config_file_name_.c_str(),
- "Policy", "PoliciesTable", value))
+ kPolicySection, "PoliciesTable", value))
&& ('\0' != *value)) {
policies_file_name_ = value;
LOG4CXX_INFO(logger_, "Set policy file to " << policies_file_name_);
*value = '\0';
if ((0 != ini_read_value(config_file_name_.c_str(),
- "Policy", "PreloadedPT", value))
+ kPolicySection, "PreloadedPT", value))
&& ('\0' != *value)) {
preloaded_pt_file_ = value;
LOG4CXX_INFO(logger_, "Set preloaded policy file to "
<< preloaded_pt_file_);
}
+ (void) ReadStringValue(&policy_shapshot_file_name_,
+ kDefaultPoliciesSnapshotFileName,
+ kPolicySection, "PathToSnapshot");
+
*value = '\0';
if ((0 != ini_read_value(config_file_name_.c_str(),
"MAIN", "HMICapabilities", value))
std::vector<std::string> ListFiles(const std::string& directory_name);
/**
+ * @brief Creates or overwrites file with given binary contents
+ * @param name path to the file
+ * @param contents data to be written into the file
+ * @returns true if file write succeeded
+ */
+bool WriteBinaryFile(const std::string& name,
+ const std::vector<uint8_t>& contents);
+
+/**
* @brief Reads from file
*
* @param name path to file
return listFiles;
}
+bool file_system::WriteBinaryFile(const std::string& name,
+ const std::vector<uint8_t>& contents) {
+ using namespace std;
+ ofstream output(name.c_str(), ios_base::binary|ios_base::trunc);
+ output.write(reinterpret_cast<const char*>(&contents.front()),
+ contents.size());
+ return output.good();
+}
+
bool file_system::ReadBinaryFile(const std::string& name,
std::vector<uint8_t>& result) {
if (!FileExists(name) || !IsAccessible(name, R_OK)) {