Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

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/m2mresource.h"
00024 #include "mbed-client/m2mobject.h"
00025 
00026 namespace FirmwareUpdateResource {
00027 
00028     typedef enum {
00029         ARM_UCS_LWM2M_STATE_FIRST       = 0,
00030         ARM_UCS_LWM2M_STATE_IDLE        = ARM_UCS_LWM2M_STATE_FIRST,
00031         ARM_UCS_LWM2M_STATE_DOWNLOADING = 1,
00032         ARM_UCS_LWM2M_STATE_DOWNLOADED  = 2,
00033         ARM_UCS_LWM2M_STATE_UPDATING    = 3,
00034         ARM_UCS_LWM2M_STATE_LAST        = ARM_UCS_LWM2M_STATE_UPDATING
00035     } arm_ucs_lwm2m_state_t;
00036 
00037     typedef enum {
00038         ARM_UCS_LWM2M_RESULT_FIRST            = 0,
00039         ARM_UCS_LWM2M_RESULT_INITIAL          = ARM_UCS_LWM2M_RESULT_FIRST,
00040         ARM_UCS_LWM2M_RESULT_SUCCESS          = 1,
00041         ARM_UCS_LWM2M_RESULT_ERROR_STORAGE    = 2,
00042         ARM_UCS_LWM2M_RESULT_ERROR_MEMORY     = 3,
00043         ARM_UCS_LWM2M_RESULT_ERROR_CONNECTION = 4,
00044         ARM_UCS_LWM2M_RESULT_ERROR_CRC        = 5,
00045         ARM_UCS_LWM2M_RESULT_ERROR_TYPE       = 6,
00046         ARM_UCS_LWM2M_RESULT_ERROR_URI        = 7,
00047         ARM_UCS_LWM2M_RESULT_ERROR_UPDATE     = 8,
00048         ARM_UCS_LWM2M_RESULT_ERROR_HASH       = 9,
00049         ARM_UCS_LWM2M_RESULT_LAST             = ARM_UCS_LWM2M_RESULT_ERROR_HASH
00050     } arm_ucs_lwm2m_result_t;
00051 
00052     void Initialize(void);
00053     void Uninitialize(void);
00054 
00055     M2MObject* getObject(void);
00056 
00057     /* Add callback for resource /5/0/0, Package */
00058     int32_t addPackageCallback(void (*cb)(const uint8_t* buffer, uint16_t length));
00059 
00060     /* Add callback for resource /5/0/1, Package URI */
00061     int32_t addPackageURICallback(void (*cb)(const uint8_t* buffer, uint16_t length));
00062 
00063     /* Add callback for resource /5/0/2, Update */
00064     int32_t addUpdateCallback(void (*cb)(void));
00065 
00066     /* Add callback for when send{State, UpdateResult} is done */
00067     int32_t addNotificationCallback(void (*notification_handler)(void));
00068 
00069     /* Send state for resource /5/0/3, State */
00070     int32_t sendState(arm_ucs_lwm2m_state_t state);
00071 
00072     /* Send result for resource /5/0/5, Update Result */
00073     int32_t sendUpdateResult(arm_ucs_lwm2m_result_t result);
00074 
00075     /* Send name for resource /5/0/6, PkgName */
00076     int32_t sendPkgName(const uint8_t* name, uint16_t length);
00077 
00078     /* Send version for resource /5/0/7, PkgVersion */
00079     int32_t sendPkgVersion(uint64_t version);
00080 }
00081 
00082 #endif // __ARM_UCS_FIRMWARE_UPDATE_RESOURCE_H__