Maggie Mei / mbedConnectorInterfaceWithDM

Fork of mbedConnectorInterfaceWithDM by Doug Anson

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Wed Jun 15 04:24:48 2016 +0000
Parent:
41:8bfdf9cec934
Child:
43:3fb57c4fba34
Commit message:
updates for DM

Changed in this revision

source/DeviceManager.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/DeviceManager.cpp	Tue Jun 14 21:09:42 2016 +0000
+++ b/source/DeviceManager.cpp	Wed Jun 15 04:24:48 2016 +0000
@@ -155,11 +155,7 @@
         this->m_dev_res[6] = this->m_device->create_resource(M2MDevice::SoftwareVersion,this->m_sw_vers);     // Software Version
         this->m_dev_res[7] = this->getDeviceRebootResource();                                                 // Reboot
         this->m_dev_res[8] = this->m_device->create_resource(M2MDevice::FactoryReset);                        // Reset
-        
-        // DEBUG
-        if (this->m_dev_res[7] == NULL) this->m_logger->log("REBOOT RESOURCE IS NULL");
-        if (this->m_dev_res[8] == NULL) this->m_logger->log("RESET RESOURCE IS NULL");
-        
+                
         // set the callback functions for Reboot and Reset
         if (this->m_dev_res[7] != NULL) {
             this->m_dev_res[7]->set_operation(M2MBase::POST_ALLOWED);
@@ -199,14 +195,7 @@
         this->m_fw_res[4] = this->getFirmwarePackageURIResource();
         this->m_fw_res[5] = this->getFirmwareStateResource();
         this->m_fw_res[6] = this->getFirmwareUpdateResultResource();
-        
-        // DEBUG
-        if (this->m_fw_res[2] == NULL) this->m_logger->log("FW UPDATE RESOURCE IS NULL");
-        if (this->m_fw_res[3] == NULL) this->m_logger->log("FW PACKAGE RESOURCE IS NULL");
-        if (this->m_fw_res[4] == NULL) this->m_logger->log("FW PACKAGE URI RESOURCE IS NULL");
-        if (this->m_fw_res[5] == NULL) this->m_logger->log("FW STATE RESOURCE IS NULL");
-        if (this->m_fw_res[6] == NULL) this->m_logger->log("FW UPDATE RESULT RESOURCE IS NULL");
-        
+                
         // set the callback functions for Update
         if (this->m_fw_res[2] != NULL) {
             this->m_fw_res[2]->set_operation(M2MBase::POST_ALLOWED);
@@ -286,8 +275,8 @@
 // Get the Device Reboot Resource from the Device Object
 M2MResource *DeviceManager::getDeviceRebootResource() {
     if (this->m_device != NULL) {
-        // Get /3/0/4
-        return this->getResourceFromObject(this->m_device,0,4);
+        // Get /3/0/3
+        return this->getResourceFromObject(this->m_device,0,M2MDevice::Reboot);
     }
     return NULL;
 }
@@ -296,7 +285,7 @@
 M2MResource *DeviceManager::getFirmwareUpdateResource() {
     if (this->m_firmware != NULL) {
         // Get /5/0/2
-        return this->getResourceFromObject(this->m_firmware,0,2);
+        return this->getResourceFromObject(this->m_firmware,0,M2MFirmware::Update);
     }
     return NULL;
 }
@@ -305,7 +294,7 @@
 M2MResource *DeviceManager::getFirmwarePackageResource() {
     if (this->m_firmware != NULL) {
         // Get /5/0/0
-        return this->getResourceFromObject(this->m_firmware,0,0);
+        return this->getResourceFromObject(this->m_firmware,0,M2MFirmware::Package);
     }
     return NULL;
 }
@@ -314,7 +303,7 @@
 M2MResource *DeviceManager::getFirmwarePackageURIResource() {
     if (this->m_firmware != NULL) {
         // Get /5/0/1
-        return this->getResourceFromObject(this->m_firmware,0,1);
+        return this->getResourceFromObject(this->m_firmware,0,M2MFirmware::PackageUri);
     }
     return NULL;
 }
@@ -323,7 +312,7 @@
 M2MResource *DeviceManager::getFirmwareStateResource() {
     if (this->m_firmware != NULL) {
         // Get /5/0/3
-        return this->getResourceFromObject(this->m_firmware,0,3);
+        return this->getResourceFromObject(this->m_firmware,0,M2MFirmware::State);
     }
     return NULL;
 }
@@ -332,7 +321,7 @@
 M2MResource *DeviceManager::getFirmwareUpdateResultResource() {
     if (this->m_firmware != NULL) {
         // Get /5/0/5
-        return this->getResourceFromObject(this->m_firmware,0,5);
+        return this->getResourceFromObject(this->m_firmware,0,M2MFirmware::UpdateResult);
     }
     return NULL;
 }