std::string profile;
std::string address;
std::string uuid;
+ std::string sw_version;
+ std::string platform_version;
};
struct capmgr_app_control_s {
new capmgr::SQLiteConnection(kDBPath));
const char kQueryForeachDevices[] =
- "SELECT name, profile, address, uuid FROM devices";
+ "SELECT name, profile, address, uuid, sw_version, platform_version " \
+ "FROM devices";
std::shared_ptr<capmgr::SQLStatement> stmt = sql_conn->PrepareStatement(
kQueryForeachDevices);
while (stmt->Step() == capmgr::SQLStatement::StepResult::ROW) {
dev.profile = stmt->GetColumnString(1);
dev.address = stmt->GetColumnString(2);
dev.uuid = stmt->GetColumnString(3);
+ dev.sw_version = stmt->GetColumnString(4);
+ dev.platform_version = stmt->GetColumnString(5);
if (cb(&dev, user_data))
break;
}
clone->profile = device->profile;
clone->address = device->address;
clone->uuid = device->uuid;
+ clone->sw_version = device->sw_version;
+ clone->platform_version = device->platform_version;
*device_clone = clone;
} catch (const std::bad_alloc& e) {
return CAPMGR_ERROR_NONE;
}
+API int capmgr_device_get_sw_version(capmgr_device_h device,
+ char** sw_version) {
+ if (!device || !sw_version)
+ return CAPMGR_ERROR_INVALID_PARAMETER;
+
+ *sw_version = strdup(device->sw_version.c_str());
+ if (*sw_version == nullptr)
+ return CAPMGR_ERROR_OUT_OF_MEMORY;
+
+ return CAPMGR_ERROR_NONE;
+}
+
+API int capmgr_device_get_platform_version(capmgr_device_h device,
+ char** platform_version) {
+ if (!device || !platform_version)
+ return CAPMGR_ERROR_INVALID_PARAMETER;
+
+ *platform_version = strdup(device->platform_version.c_str());
+ if (*platform_version == nullptr)
+ return CAPMGR_ERROR_OUT_OF_MEMORY;
+
+ return CAPMGR_ERROR_NONE;
+}
+
API int capmgr_app_control_create(capmgr_app_control_h* app_control) {
if (!app_control)
return CAPMGR_ERROR_INVALID_PARAMETER;