Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FirmwareUpdateResource.h Source File

FirmwareUpdateResource.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef __ARM_UCS_FIRMWARE_UPDATE_RESOURCE_H__
00020 #define __ARM_UCS_FIRMWARE_UPDATE_RESOURCE_H__
00021 
00022 #include "mbed-client/m2minterfacefactory.h"
00023 #include "mbed-client/m2minterface.h"
00024 #include "mbed-client/m2mresource.h"
00025 #include "mbed-client/m2mobject.h"
00026 #include "update-client-common/arm_uc_config.h"
00027 #include "update-client-monitor/arm_uc_monitor.h"
00028 
00029 namespace FirmwareUpdateResource {
00030 
00031 // New enums based on http://www.openmobilealliance.org/tech/profiles/lwm2m/10252.xml
00032 typedef arm_uc_update_state_t arm_ucs_lwm2m_state_t;
00033 typedef arm_uc_update_result_t arm_ucs_lwm2m_result_t;
00034 
00035 void Initialize(void);
00036 void Uninitialize(void);
00037 
00038 M2MObject *getObject(void);
00039 
00040 /* Add callback for resource /10252/0/1, Package */
00041 int32_t addPackageCallback(void (*cb)(const uint8_t *buffer, uint16_t length));
00042 
00043 #if !defined(ARM_UC_PROFILE_MBED_CLIENT_LITE) || (ARM_UC_PROFILE_MBED_CLIENT_LITE == 0)
00044 /* Add callback for resource /5/0/2, Update */
00045 int32_t addUpdateCallback(void (*cb)(void));
00046 #endif
00047 
00048 /* Add callback for when send{State, UpdateResult} is done */
00049 int32_t addNotificationCallback(void (*notification_handler)(void));
00050 
00051 /* Send state for resource /10252/0/2, State */
00052 int32_t sendState(arm_ucs_lwm2m_state_t state);
00053 
00054 /* Send result for resource /10252/0/3, Update Result */
00055 int32_t sendUpdateResult(arm_ucs_lwm2m_result_t result);
00056 
00057 /* Send name for resource /10252/0/5, PkgName */
00058 int32_t sendPkgName(const uint8_t *name, uint16_t length);
00059 
00060 /* Send version for resource /10252/0/6, PkgVersion */
00061 int32_t sendPkgVersion(uint64_t version);
00062 
00063 #if defined(ARM_UC_FEATURE_FW_SOURCE_COAP) && (ARM_UC_FEATURE_FW_SOURCE_COAP == 1)
00064 int32_t setM2MInterface(M2MInterface *interface);
00065 
00066 M2MInterface *getM2MInterface(void);
00067 #endif //ARM_UC_FEATURE_FW_SOURCE_COAP
00068 }
00069 
00070 #endif // __ARM_UCS_FIRMWARE_UPDATE_RESOURCE_H__