Skip to content

Commit

Permalink
fixup! feat: add deserializer for c8y_DeviceProfile json object
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruadhri17 committed Aug 1, 2024
1 parent 6ab2b7f commit 9915fd2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions crates/core/c8y_api/src/json_c8y_deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,19 @@ impl TryFrom<C8ySoftwareUpdate> for SoftwareInfo {
update_list: Vec::new(),
};

for module in value.modules() {
for module in value.lists {
let plugin_type = module
.get_module_version_and_type()
.1
.unwrap_or_else(SoftwareModule::default_type);

let version = module.get_module_version_and_type().0;
let url = module.get_url();

let item = SoftwareModuleItem {
name: module.name.clone(),
version: module.get_module_version_and_type().0,
url: module.get_url(),
name: module.name,
version,
url,
action: match module.action.clone().try_into()? {
C8ySoftwareUpdateAction::Install => Some(SoftwareModuleAction::Install),
C8ySoftwareUpdateAction::Delete => Some(SoftwareModuleAction::Remove),
Expand Down Expand Up @@ -448,8 +451,8 @@ pub struct C8yDownloadConfigFile {
impl From<C8yDownloadConfigFile> for ConfigInfo {
fn from(value: C8yDownloadConfigFile) -> Self {
ConfigInfo {
config_type: value.config_type.clone(),
remote_url: Some(value.url.clone()),
config_type: value.config_type,
remote_url: Some(value.url),
}
}
}
Expand Down Expand Up @@ -481,9 +484,9 @@ pub struct C8yFirmware {
impl From<C8yFirmware> for FirmwareInfo {
fn from(value: C8yFirmware) -> Self {
FirmwareInfo {
name: Some(value.name.clone()),
version: Some(value.version.clone()),
remote_url: Some(value.url.clone()),
name: Some(value.name),
version: Some(value.version),
remote_url: Some(value.url),
}
}
}
Expand Down

0 comments on commit 9915fd2

Please sign in to comment.