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 pal_device_identity.h Source File

pal_device_identity.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 PAL4LIFE_DEVICE_IDENTITY_H
00020 #define PAL4LIFE_DEVICE_IDENTITY_H
00021 
00022 #include "update-client-common/arm_uc_common.h"
00023 
00024 #include <stdbool.h>
00025 #include <stdint.h>
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 /**
00032  * @brief Function for setting the vendor GUID.
00033  * @details The GUID is copied.
00034  * @param vendor_guid Pointer to a arm_uc_guid_t GUID.
00035  * @return Error code.
00036  */
00037 arm_uc_error_t pal_setVendorGuid(const arm_uc_guid_t* vendor_guid);
00038 
00039 /**
00040  * @brief Function for getting a pointer to the vendor GUID.
00041  * @param vendor_guid Pointer to a arm_uc_guid_t pointer.
00042  * @return Error code.
00043  */
00044 arm_uc_error_t pal_getVendorGuid(arm_uc_guid_t* vendor_guid);
00045 
00046 /**
00047  * @brief Function for setting the device class GUID.
00048  * @details The GUID is copied.
00049  * @param class_guid Pointer to a arm_uc_guid_t GUID.
00050  * @return Error code.
00051  */
00052 arm_uc_error_t pal_setClassGuid(const arm_uc_guid_t* class_guid);
00053 
00054 /**
00055  * @brief Function for getting a pointer to the device class GUID.
00056  * @param class_guid Pointer to a arm_uc_guid_t pointer.
00057  * @return Error code.
00058  */
00059 arm_uc_error_t pal_getClassGuid(arm_uc_guid_t* class_guid);
00060 
00061 /**
00062  * @brief Function for setting the device GUID.
00063  * @details The GUID is copied.
00064  * @param device_guid Pointer to a arm_uc_guid_t GUID.
00065  * @return Error code.
00066  */
00067 arm_uc_error_t pal_setDeviceGuid(const arm_uc_guid_t* device_guid);
00068 
00069 /**
00070  * @brief Function for getting a pointer to the device GUID.
00071  * @param device_guid Pointer to a arm_uc_guid_t pointer.
00072  * @return Error code.
00073  */
00074 arm_uc_error_t pal_getDeviceGuid(arm_uc_guid_t* device_guid);
00075 
00076 /**
00077  * @brief Check whether the three GUIDs provided are valid on the device.
00078  * @details
00079  * @param vendor_guid Buffer pointer to the Vendor GUID.
00080  * @param class_guid  Buffer pointer to the device class GUID.
00081  * @param device_guid Buffer pointer to the device GUID.
00082  * @return Error code.
00083  */
00084 arm_uc_error_t pal_deviceIdentityCheck(const arm_uc_buffer_t* vendor_guid,
00085                                        const arm_uc_buffer_t* class_guid,
00086                                        const arm_uc_buffer_t* device_guid);
00087 
00088 /**
00089  * @brief Structure definition holding API function pointers.
00090  */
00091 typedef struct _ARM_PAL_DEVICE_IDENTITY {
00092     /**
00093      * @brief Function for setting the vendor GUID.
00094      * @details The GUID is copied.
00095      * @param vendor_guid Pointer to a arm_uc_guid_t GUID.
00096      * @return Error code.
00097      */
00098     arm_uc_error_t (*SetVendorGuid)(const arm_uc_guid_t* vendor_guid);
00099 
00100     /**
00101      * @brief Function for getting a pointer to the vendor GUID.
00102      * @param vendor_guid Pointer to a arm_uc_guid_t pointer.
00103      * @return Error code.
00104      */
00105     arm_uc_error_t (*GetVendorGuid)(arm_uc_guid_t* vendor_guid);
00106 
00107     /**
00108      * @brief Function for setting the device class GUID.
00109      * @details The GUID is copied.
00110      * @param class_guid Pointer to a arm_uc_guid_t GUID.
00111      * @return Error code.
00112      */
00113     arm_uc_error_t (*SetClassGuid)(const arm_uc_guid_t* class_guid);
00114 
00115     /**
00116      * @brief Function for getting a pointer to the device class GUID.
00117      * @param class_guid Pointer to a arm_uc_guid_t pointer.
00118      * @return Error code.
00119      */
00120     arm_uc_error_t (*GetClassGuid)(arm_uc_guid_t* class_guid);
00121 
00122     /**
00123      * @brief Function for setting the device GUID.
00124      * @details The GUID is copied.
00125      * @param device_guid Pointer to a arm_uc_guid_t GUID.
00126      * @return Error code.
00127      */
00128     arm_uc_error_t (*SetDeviceGuid)(const arm_uc_guid_t* device_guid);
00129 
00130     /**
00131      * @brief Function for getting a pointer to the device GUID.
00132      * @param device_guid Pointer to a arm_uc_guid_t pointer.
00133      * @return Error code.
00134      */
00135     arm_uc_error_t (*GetDeviceGuid)(arm_uc_guid_t* device_guid);
00136 
00137     /**
00138      * @brief Check whether the three GUIDs provided are valid on the device.
00139      * @details
00140      * @param vendor_guid Buffer pointer to the Vendor GUID.
00141      * @param class_guid  Buffer pointer to the device class GUID.
00142      * @param device_guid Buffer pointer to the device GUID.
00143      * @return Error code.
00144      */
00145     arm_uc_error_t (*DeviceIdentityCheck)(const arm_uc_buffer_t* vendor_guid,
00146                                           const arm_uc_buffer_t* class_guid,
00147                                           const arm_uc_buffer_t* device_guid);
00148 } ARM_PAL_DEVICE_IDENTITY;
00149 
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153 
00154 #endif // PAL4LIFE_DEVICE_IDENTITY_H