mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

NOTE:

This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!

Revision:
30:db367366b1f5
Parent:
14:d9ce4e56684e
Child:
48:c02f2665cf76
--- a/source/DeviceManagementResponder.cpp	Tue Jun 14 05:54:20 2016 +0000
+++ b/source/DeviceManagementResponder.cpp	Tue Jun 14 18:40:15 2016 +0000
@@ -26,6 +26,9 @@
  // Endpoint support
  #include "mbed-connector-interface/ConnectorEndpoint.h"
  
+ // DeviceManager Support
+ #include "mbed-connector-interface/DeviceManager.h"
+ 
  // constructor
  DeviceManagementResponder::DeviceManagementResponder(const Logger *logger,const Authenticator *authenticator) {
      this->m_logger = (Logger *)logger;
@@ -34,8 +37,9 @@
      this->m_reboot_responder_fn = NULL;
      this->m_reset_responder_fn = NULL;
      this->m_fota_invocation_fn = NULL;
-     this->m_fota_manifest = NULL;
-     this->m_firmware_composite_resource = NULL;
+     this->m_manifest = NULL;
+     this->m_fota_image = NULL;
+     this->m_fota_image_length = 0;
 }
 
 // copy constructor
@@ -46,8 +50,9 @@
     this->m_reboot_responder_fn = responder.m_reboot_responder_fn;
     this->m_reset_responder_fn = responder.m_reset_responder_fn;
     this->m_fota_invocation_fn = responder.m_fota_invocation_fn;
-    this->m_fota_manifest = responder.m_fota_manifest;
-    this->m_firmware_composite_resource = responder.m_firmware_composite_resource;
+    this->m_manifest = responder.m_manifest;
+    this->m_fota_image = responder.m_fota_image;
+    this->m_fota_image_length = responder.m_fota_image_length;
 }
 
 // destructor
@@ -83,16 +88,30 @@
 }
 
 // set the FOTA manifest
-void DeviceManagementResponder::setFOTAManifest(const char *fota_manifest) {
-    // DEBUG
-    this->m_logger->log("DeviceManagementResponder(Set FOTA Manifiest): Setting FOTA Manifest: %s",fota_manifest);
-    
-    // set the FOTA manifest for action later
-    this->m_fota_manifest = (char *)fota_manifest;
+void DeviceManagementResponder::setFOTAManifest(char *manifest) {
+    this->m_manifest = manifest;
 }
 
 // get the FOTA manifest
-char *DeviceManagementResponder::getFOTAManifest() { return this->m_fota_manifest; }
+char *DeviceManagementResponder::getFOTAManifest() {
+    return this->m_manifest;
+}
+
+// set the FOTA Image
+void DeviceManagementResponder::setFOTAImage(void *fota_image,uint32_t fota_image_length) {
+    this->m_fota_image = fota_image;
+    this->m_fota_image_length = fota_image_length;
+}
+
+// get the FOTA Image
+void *DeviceManagementResponder::getFOTAImage() {
+    return this->m_fota_image;
+}
+
+// get the FOTA Image Length
+uint32_t DeviceManagementResponder::getFOTAImageLength() {
+    return this->m_fota_image_length;
+}
 
 // ACTION: deregister device
 void DeviceManagementResponder::deregisterDevice(const void *challenge) {
@@ -180,10 +199,7 @@
             // authenticate
             if (this->authenticate(challenge)) {
                 // act
-                (*this->m_fota_invocation_fn)((const void *)this->m_endpoint,(const void *)this->m_logger,this->m_fota_manifest);
-                
-                // reset the FOTA manifest
-                this->m_fota_manifest = NULL;
+                (*this->m_fota_invocation_fn)((const void *)this->m_endpoint,(const void *)this->m_logger,this->getFOTAManifest());
             }
             else {
                 // authentication failure
@@ -199,12 +215,4 @@
         // no FOTA invocation handler
         this->m_logger->log("DeviceManagementResponder(FOTA): No FOTA invocation handler pointer. No action taken.");
     }
-}
-
-// set the firmware composite resource
-void DeviceManagementResponder::setFirmwareCompositeResource(const void *firmware_composite_resource) {
-    this->m_firmware_composite_resource = (void *)firmware_composite_resource;
-}
-
-// get the firmware composie resource
-void *DeviceManagementResponder::getFirmwareCompositeResource() { return this->m_firmware_composite_resource; }
+}
\ No newline at end of file