+ \anchor error_code_overview + Theory: +
+ Every API under Mesh Protocol Suite returns \ref API_RESULT, + which is a 2 Byte Unsigned Short variable. The higher order byte + signifies the Module from which the Error has been generated, and + the lower order byte encodes the actual reason of Error. +
+ Each module under Mesh Stack is given unique + Error ID (the higher order byte). Also, for each module the Error + Code (the lower order byte) signifies an unique error situation. +
+ For Mesh Protocol Modules (eg, Transport, Network etc.), Error IDs are + assigned from the range 0x10 to 0x4F. For Profiles, the range + is from 0x50 to 0x7F. +
+ The definition of \ref API_SUCCESS is 0x0000 - which is the 'Success' + return value for an API returning \ref API_RESULT. All other values for + should be treated as Errors. +
+ The definition of \ref API_FAILURE is 0xFFFF - which stands for + "Unknown Error Situation". +
+ Note: +
+ The applications using native/profile Mesh API should NOT do + any check on the basis of \ref API_FAILURE - rather, the correct way to + detect an error situation is by doing a negative check on \ref + API_SUCCESS. +
+ For example, + \code if ( API_FAILURE == MS_access_register_model(x, y, z) ) \endcode + ... Wrong ! +
+
+ \code if ( API_SUCCESS != MS_access_register_model(x, y, z) ) \endcode
+ ... Correct !
+*/
+
+/**
+ \defgroup ms_error_codes_defines Defines
+ \{
+*/
+
+/** Definition of API_RESULT */
+
+#ifndef API_RESULT_DEFINED
+ typedef UINT16 API_RESULT;
+ #define API_RESULT_DEFINED
+#endif /* API_RESULT_DEFINED */
+
+/* Definitions of API_SUCCESS & API_FAILURE */
+#ifdef API_SUCCESS
+ #undef API_SUCCESS
+#endif /* API_SUCCESS */
+/** Status - 'Success' */
+#define API_SUCCESS 0x0000
+
+#ifdef API_FAILURE
+ #undef API_FAILURE
+#endif /* API_FAILURE */
+/** Status - 'Failure' */
+#define API_FAILURE 0xFFFF
+
+/** \} */
+
+/* ====================== EtherMind Module Error IDs ====================== */
+
+/**
+ \defgroup ms_error_codes_groups Error Grouping
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_groups_std Specification Error Codes (0x00 - 0x0F)
+ Error IDs for Bluetooth Specification Defined Error Codes (0x00 - 0x0F).
+ \{
+*/
+
+/** Error Codes for Mesh - \ref ms_error_codes_module_mesh */
+#define MS_ERR_ID 0x0000
+/** \cond ignore */
+/** \endcond */
+
+/** \} */
+
+/**
+ \defgroup ms_error_codes_groups_core Core Modules (0x10 - 0x1F)
+ Error IDs for Mesh Core Modules (0x10 - 0x1F).
+ \{
+*/
+
+/** Error Codes for MS Common - \ref ms_error_codes_module_common */
+#define MS_COMMON_ERR_ID 0x1000
+/** Error Codes for Timer - \ref ms_error_codes_module_timer */
+#define TIMER_ERR_ID 0x1200
+
+/** \} */
+
+/**
+ \defgroup ms_error_codes_groups_protocols Protocols (0x20 - 0x3F)
+ Error IDs for Mesh Protocol Modules (0x20 - 0x3F).
+ \{
+*/
+
+/** Error Codes for Bearer - \ref ms_error_codes_module_brr */
+#define BRR_ERR_ID 0x2000
+#define NET_ERR_ID 0x2100
+#define LTRN_ERR_ID 0x2200
+#define TRN_ERR_ID 0x2300
+#define ACCESS_ERR_ID 0x2400
+
+#define PROV_ERR_ID 0x3000
+
+#define HEALTH_ERR_ID 0x8000
+
+/** \} */
+
+
+/** \} */
+
+/** \} */
+/** \} */
+
+/* ================== EtherMind Common Reason Error Codes ================= */
+
+/**
+ \addtogroup ms_common_defines Defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_common Common
+ \{
+*/
+
+#define MUTEX_INIT_FAILED 0x0001
+#define COND_INIT_FAILED 0x0002
+#define MUTEX_LOCK_FAILED 0x0003
+#define MUTEX_UNLOCK_FAILED 0x0004
+#define MEMORY_ALLOCATION_FAILED 0x0005
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Mesh' */
+/**
+ \addtogroup MS_ERROR_CODES
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_mesh Mesh Result Codes
+ \{
+*/
+#define MS_SUCCESS (0x0000 | MS_ERR_ID)
+/** Invalid Address */
+#define MS_INVALID_ADDRESS (0x0001 | MS_ERR_ID)
+/** Invalid Model */
+#define MS_INVALID_MODEL (0x0002 | MS_ERR_ID)
+/** Invalid AppKey Index */
+#define MS_INVALID_APPKEY_INDEX (0x0003 | MS_ERR_ID)
+/** Invalid NetKey Index */
+#define MS_INVALID_NETKEY_INDEX (0x0004 | MS_ERR_ID)
+/** Insufficient Resources */
+#define MS_INSUFFICIENT_RESOURCES (0x0005 | MS_ERR_ID)
+/** Key Index Already Stored */
+#define MS_KEY_INDEX_ALREADY_STORED (0x0006 | MS_ERR_ID)
+/** Invalid Publish Parameters */
+#define MS_INVALID_PUBLISH_PARAMETER (0x0007 | MS_ERR_ID)
+/** Not a Subscribe Model */
+#define MS_NOT_A_SUBSCRIBE_MODEL (0x0008 | MS_ERR_ID)
+/** Storage Failure */
+#define MS_STORAGE_FAILURE (0x0009 | MS_ERR_ID)
+/** Feature Not Supported */
+#define MS_FEATURE_NOT_SUPPORTED (0x000A | MS_ERR_ID)
+/** Cannot Update */
+#define MS_CANNOT_UPDATE (0x000B | MS_ERR_ID)
+/** Cannot Remove */
+#define MS_CANNOT_REMOVE (0x000C | MS_ERR_ID)
+/** Cannot Bind */
+#define MS_CANNOT_BIND (0x000D | MS_ERR_ID)
+/** Temporarily Unable to Change State */
+#define MS_TEMP_UNABLE_TO_CHANGE_STATE (0x000E | MS_ERR_ID)
+/** Cannot Set */
+#define MS_CANNOT_SET (0x000F | MS_ERR_ID)
+/** Unspecified Error */
+#define MS_UNSPECIFIED_ERROR (0x0010 | MS_ERR_ID)
+/** Invalid Binding */
+#define MS_INVALID_BINDING (0x0011 | MS_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ===================== EtherMind Module Error Codes ===================== */
+
+/* ======================================= Section 'Timer' */
+/**
+ \cond ignore_this
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_timer Timer
+ \{
+*/
+
+#define TIMER_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | TIMER_ERR_ID)
+#define TIMER_COND_INIT_FAILED \
+ (COND_INIT_FAILED | TIMER_ERR_ID)
+#define TIMER_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | TIMER_ERR_ID)
+#define TIMER_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | TIMER_ERR_ID)
+#define TIMER_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | TIMER_ERR_ID)
+
+#define TIMER_HANDLE_IS_NULL (0x0011 | TIMER_ERR_ID)
+#define TIMER_CALLBACK_IS_NULL (0x0012 | TIMER_ERR_ID)
+#define TIMER_QUEUE_EMPTY (0x0013 | TIMER_ERR_ID)
+#define TIMER_QUEUE_FULL (0x0014 | TIMER_ERR_ID)
+#define TIMER_ENTITY_SEARCH_FAILED (0x0015 | TIMER_ERR_ID)
+#define TIMER_NULL_PARAMETER_NOT_ALLOWED (0x0016 | TIMER_ERR_ID)
+#define TIMER_TIMEOUT_ZERO_NOT_ALLOWED (0x0017 | TIMER_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Bearer' */
+/**
+ \addtogroup brr_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_brr Error Code
+ \{
+*/
+
+#define BRR_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | BRR_ERR_ID)
+#define BRR_COND_INIT_FAILED \
+ (COND_INIT_FAILED | BRR_ERR_ID)
+#define BRR_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | BRR_ERR_ID)
+#define BRR_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | BRR_ERR_ID)
+#define BRR_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | BRR_ERR_ID)
+
+#define BRR_INVALID_PARAMETER_VALUE (0x0011 | BRR_ERR_ID)
+#define BRR_PARAMETER_OUTSIDE_RANGE (0x0012 | BRR_ERR_ID)
+#define BRR_NULL_PARAMETER_NOT_ALLOWED (0x0013 | BRR_ERR_ID)
+#define BRR_INTERFACE_NOT_READY (0x0014 | BRR_ERR_ID)
+#define BRR_API_NOT_SUPPORTED (0x00FF | BRR_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Network' */
+/**
+ \addtogroup net_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_net Error Code
+ \{
+*/
+
+#define NET_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | NET_ERR_ID)
+#define NET_COND_INIT_FAILED \
+ (COND_INIT_FAILED | NET_ERR_ID)
+#define NET_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | NET_ERR_ID)
+#define NET_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | NET_ERR_ID)
+#define NET_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | NET_ERR_ID)
+
+#define NET_INVALID_PARAMETER_VALUE (0x0011 | NET_ERR_ID)
+#define NET_PARAMETER_OUTSIDE_RANGE (0x0012 | NET_ERR_ID)
+#define NET_NULL_PARAMETER_NOT_ALLOWED (0x0013 | NET_ERR_ID)
+#define NET_TX_QUEUE_FULL (0x0014 | NET_ERR_ID)
+#define NET_TX_QUEUE_EMPTY (0x0015 | NET_ERR_ID)
+
+/**
+ Error Codes returned by Network Callback, indicating if it detected
+ an invalid packet format or if the packet to be further processed,
+ by the network layer like to be relayed or proxied etc.
+*/
+#define NET_INVALID_RX_PKT_FORMAT (0x0016 | NET_ERR_ID)
+#define NET_RX_LOCAL_SRC_ADDR_PKT (0x0017 | NET_ERR_ID)
+#define NET_POST_PROCESS_RX_PKT (0x0018 | NET_ERR_ID)
+
+#define NET_API_NOT_SUPPORTED (0x00FF | NET_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Lower Transport' */
+/**
+ \addtogroup ltrn_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_ltrn Error Code
+ \{
+*/
+
+#define LTRN_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | LTRN_ERR_ID)
+#define LTRN_COND_INIT_FAILED \
+ (COND_INIT_FAILED | LTRN_ERR_ID)
+#define LTRN_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | LTRN_ERR_ID)
+#define LTRN_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | LTRN_ERR_ID)
+#define LTRN_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | LTRN_ERR_ID)
+
+#define LTRN_INVALID_PARAMETER_VALUE (0x0011 | LTRN_ERR_ID)
+#define LTRN_PARAMETER_OUTSIDE_RANGE (0x0012 | LTRN_ERR_ID)
+#define LTRN_NULL_PARAMETER_NOT_ALLOWED (0x0013 | LTRN_ERR_ID)
+#define LTRN_SAR_CTX_ALLOCATION_FAILED (0x0014 | LTRN_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Transport' */
+/**
+ \addtogroup trn_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_trn Error Code
+ \{
+*/
+
+#define TRN_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | TRN_ERR_ID)
+#define TRN_COND_INIT_FAILED \
+ (COND_INIT_FAILED | TRN_ERR_ID)
+#define TRN_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | TRN_ERR_ID)
+#define TRN_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | TRN_ERR_ID)
+#define TRN_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | TRN_ERR_ID)
+
+#define TRN_INVALID_PARAMETER_VALUE (0x0011 | TRN_ERR_ID)
+#define TRN_PARAMETER_OUTSIDE_RANGE (0x0012 | TRN_ERR_ID)
+#define TRN_NULL_PARAMETER_NOT_ALLOWED (0x0013 | TRN_ERR_ID)
+#define TRN_QUEUE_FULL (0x0014 | TRN_ERR_ID)
+#define TRN_QUEUE_EMPTY (0x0015 | TRN_ERR_ID)
+#define TRN_INCOMPLETE_PKT_RECEIVED (0x0016 | TRN_ERR_ID)
+#define TRN_INVALID_FRNDSHIP_STATE (0x0017 | TRN_ERR_ID)
+
+#define TRN_API_NOT_SUPPORTED (0x00FF | TRN_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Access' */
+/**
+ \addtogroup access_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_access Error Code
+ \{
+*/
+
+#define ACCESS_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | ACCESS_ERR_ID)
+#define ACCESS_COND_INIT_FAILED \
+ (COND_INIT_FAILED | ACCESS_ERR_ID)
+#define ACCESS_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | ACCESS_ERR_ID)
+#define ACCESS_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | ACCESS_ERR_ID)
+#define ACCESS_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | ACCESS_ERR_ID)
+
+#define ACCESS_INVALID_PARAMETER_VALUE (0x0011 | ACCESS_ERR_ID)
+#define ACCESS_PARAMETER_OUTSIDE_RANGE (0x0012 | ACCESS_ERR_ID)
+#define ACCESS_NULL_PARAMETER_NOT_ALLOWED (0x0013 | ACCESS_ERR_ID)
+
+#define ACCESS_NO_RESOURCE (0x0020 | ACCESS_ERR_ID)
+#define ACCESS_NO_MATCH (0x0021 | ACCESS_ERR_ID)
+#define ACCESS_INVALID_HANDLE (0x0022 | ACCESS_ERR_ID)
+#define ACCESS_MODEL_ALREADY_REGISTERED (0x0023 | ACCESS_ERR_ID)
+#define ACCESS_INVALID_SRC_ADDR (0x0024 | ACCESS_ERR_ID)
+#define ACCESS_DEV_KEY_TABLE_FULL (0x0025 | ACCESS_ERR_ID)
+#define ACCESS_MASTER_NID_ON_LPN (0x0026 | ACCESS_ERR_ID)
+#define ACCESS_INVALID_PUBLICATION_STATE (0x0027 | ACCESS_ERR_ID)
+
+#define ACCESS_API_NOT_SUPPORTED (0x00FF | ACCESS_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Provisioning' */
+/**
+ \addtogroup prov_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_provisioning Error Code
+ \{
+*/
+
+#define PROV_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | PROV_ERR_ID)
+#define PROV_COND_INIT_FAILED \
+ (COND_INIT_FAILED | PROV_ERR_ID)
+#define PROV_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | PROV_ERR_ID)
+#define PROV_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | PROV_ERR_ID)
+#define PROV_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | PROV_ERR_ID)
+
+#define PROV_INVALID_STATE (0x0011 | PROV_ERR_ID)
+#define PROV_INVALID_PARAMETER (0x0012 | PROV_ERR_ID)
+#define PROV_CONTEXT_ALLOC_FAILED (0x0013 | PROV_ERR_ID)
+#define PROV_CONTEXT_ASSERT_FAILED (0x0014 | PROV_ERR_ID)
+#define PROV_CONTEXT_LINK_OPEN (0x0015 | PROV_ERR_ID)
+#define PROV_BEARER_ASSERT_FAILED (0x0016 | PROV_ERR_ID)
+#define PROV_PROCEDURE_TIMEOUT (0x0017 | PROV_ERR_ID)
+
+/** \} */
+/** \} */
+
+/* ======================================= Section 'Health Server' */
+/**
+ \addtogroup health_server_defines
+ \{
+*/
+
+/**
+ \defgroup ms_error_codes_module_health_server Error Code
+ \{
+*/
+
+#define HEALTH_MUTEX_INIT_FAILED \
+ (MUTEX_INIT_FAILED | HEALTH_ERR_ID)
+#define HEALTH_COND_INIT_FAILED \
+ (COND_INIT_FAILED | HEALTH_ERR_ID)
+#define HEALTH_MUTEX_LOCK_FAILED \
+ (MUTEX_LOCK_FAILED | HEALTH_ERR_ID)
+#define HEALTH_MUTEX_UNLOCK_FAILED \
+ (MUTEX_UNLOCK_FAILED | HEALTH_ERR_ID)
+#define HEALTH_MEMORY_ALLOCATION_FAILED \
+ (MEMORY_ALLOCATION_FAILED | HEALTH_ERR_ID)
+
+#define HEALTH_INVALID_STATE (0x0011 | HEALTH_ERR_ID)
+#define HEALTH_INVALID_PARAMETER (0x0012 | HEALTH_ERR_ID)
+#define HEALTH_CONTEXT_ALLOC_FAILED (0x0013 | HEALTH_ERR_ID)
+#define HEALTH_CONTEXT_ASSERT_FAILED (0x0014 | HEALTH_ERR_ID)
+
+/** \} */
+/** \} */
+
+#endif /* _H_MS_ERROR_ */
+
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_battery_api.h b/src/components/ethermind/mesh/export/include/MS_generic_battery_api.h
new file mode 100644
index 0000000..a75cdc3
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_battery_api.h
@@ -0,0 +1,292 @@
+/**
+ \file MS_generic_battery_api.h
+
+ \brief This file defines the Mesh Generic Battery Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_BATTERY_API_
+#define _H_MS_GENERIC_BATTERY_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_battery_module GENERIC_BATTERY (Mesh Generic Battery Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_battery_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Battery Server application Asynchronous Notification Callback.
+
+ Generic Battery Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_BATTERY_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Battery Client application Asynchronous Notification Callback.
+
+ Generic Battery Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_BATTERY_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_battery_structures Structures
+ \{
+*/
+
+/**
+ The Generic Battery state is a set of four values representing the state of a battery:
+ - a charge level (Generic Battery Level)
+ - remaining time to complete discharging (Generic Battery Time to Discharge)
+ - remaining time to complete charging (Generic Battery Time to Charge)
+ - flags bit field (Generic Battery Flags)
+*/
+typedef struct MS_generic_battery_status_struct
+{
+ /**
+ Generic Battery Level.
+ The Generic Battery Level state is a value ranging from 0 percent through 100 percent.
+
+ Value | Description
+ ----------|------------
+ 0x00-0x64 | The percentage of the charge level. 100% represents fully charged. 0% represents fully discharged.
+ 0x65-0xFE | Prohibited
+ 0xFF | The percentage of the charge level is unknown.
+ */
+ UCHAR battery_level;
+
+ /**
+ The Generic Battery Time to Discharge state is a 24-bit unsigned value ranging from 0 through 0xFFFFFF.
+
+ Value | Description
+ ------------------|------------
+ 0x000000-0xFFFFFE | The remaining time (in minutes) of the discharging process
+ 0xFFFFFF | The remaining time of the discharging process is not known.
+ */
+ UINT32 time_to_discharge;
+
+ /**
+ The Generic Battery Time to Charge state is a 24-bit unsigned value ranging from 0 through 0xFFFFFF.
+
+ Value | Description
+ ------------------|------------
+ 0x000000-0xFFFFFE | The remaining time (in minutes) of the charging process
+ 0xFFFFFF | The remaining time of the charging process is not known.
+ */
+ UINT32 time_to_charge;
+
+ /**
+ The Generic Battery Flags state is a concatenation of four 2-bit bit fields: Presence, Indicator, Charging, and Serviceability
+
+ Bit | Description
+ -----|------------
+ 0-1 | Generic Battery Flags Presence
+ 2-3 | Generic Battery Flags Indicator
+ 4-5 | Generic Battery Flags Charging
+ 6-7 | Generic Battery Flags Serviceability
+ */
+ UCHAR flags;
+
+} MS_GENERIC_BATTERY_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_battery_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Battery Model APIs.
+*/
+/**
+ \defgroup generic_battery_ser_api_defs Generic Battery Server API Definitions
+ \{
+ This section describes the Generic Battery Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Battery Server model
+
+ \par Description
+ This is to initialize Generic_Battery Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Battery Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_battery_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_BATTERY_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_battery_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_battery_cli_api_defs Generic Battery Client API Definitions
+ \{
+ This section describes the Generic Battery Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Battery Client model
+
+ \par Description
+ This is to initialize Generic_Battery Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Battery Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_battery_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_BATTERY_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Battery client model handle
+
+ \par Description
+ This is to get the handle of Generic_Battery client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_battery_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_battery_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Generic Battery state of an element.
+
+ \par Description
+ Generic Battery Get message is an acknowledged message used to get the Generic Battery state of an element.
+ The response to the Generic Battery Get message is a Generic Battery Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_battery_get() \
+ MS_generic_battery_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_BATTERY_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_BATTERY_STATUS_OPCODE\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_BATTERY_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_default_transition_time_api.h b/src/components/ethermind/mesh/export/include/MS_generic_default_transition_time_api.h
new file mode 100644
index 0000000..9b6614e
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_default_transition_time_api.h
@@ -0,0 +1,319 @@
+/**
+ \file MS_generic_default_transition_time_api.h
+
+ \brief This file defines the Mesh Generic Default Transition Time Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_DEFAULT_TRANSITION_TIME_API_
+#define _H_MS_GENERIC_DEFAULT_TRANSITION_TIME_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+#include "MS_model_states.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_default_transition_time_module GENERIC_DEFAULT_TRANSITION_TIME (Mesh Generic Default Transition Time Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_default_transition_time_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Default Transition Time Server application Asynchronous Notification Callback.
+
+ Generic Default Transition Time Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_DEFAULT_TRANSITION_TIME_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Default Transition Time Client application Asynchronous Notification Callback.
+
+ Generic Default Transition Time Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_DEFAULT_TRANSITION_TIME_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_default_transition_time_structures Structures
+ \{
+*/
+
+/**
+ The Generic Default Transition Time state determines how long an element shall take to transition
+ from a present state to a new state.
+ This is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ This mechanism covers a wide range of times that may be required by different applications:
+ - For 100 millisecond step resolution, the range is 0 through 6.2 seconds.
+ - For 1 second step resolution, the range is 0 through 62 seconds.
+ - For 10 seconds step resolution, the range is 0 through 620 seconds (10.5 minutes).
+ - For 10 minutes step resolution, the range is 0 through 620 minutes (10.5 hours).
+
+ The Generic Default Transition Time is calculated using the following formula:
+ Generic Default Transition Time = Default Transition Step Resolution * Default Transition Number of Steps
+*/
+typedef struct MS_generic_default_transition_time_struct
+{
+ /**
+ The Default Transition Step Resolution field is a 2-bit bit field that determines
+ the resolution of the Generic Default Transition Time state.
+
+ Value | Description
+ ------|------------
+ 0b00 | The Default Transition Step Resolution is 100 milliseconds
+ 0b01 | The Default Transition Step Resolution is 1 second
+ 0b10 | The Default Transition Step Resolution is 10 seconds
+ 0b11 | The Default Transition Step Resolution is 10 minutes
+ */
+ UCHAR transition_number_of_steps;
+
+ /**
+ The Default Transition Number of Steps field is a 6-bit value representing
+ the number of transition steps.
+
+ Value | Description
+ ----------|------------
+ 0x00 | The Generic Default Transition Time is immediate.
+ 0x01-0x3E | The number of steps.
+ 0x3F | The value is unknown. The state cannot be set to this value,
+ | but an element may report an unknown value if a transition is higher than 0x3E
+ | or not determined.
+ */
+ UCHAR transition_step_resolution;
+
+} MS_GENERIC_DEFAULT_TRANSITION_TIME_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_default_transition_time_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Default Transition Time Model APIs.
+*/
+/**
+ \defgroup generic_default_transition_time_ser_api_defs Generic Default Transition Time Server API Definitions
+ \{
+ This section describes the Generic Default Transition Time Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Default_Transition_Time Server model
+
+ \par Description
+ This is to initialize Generic_Default_Transition_Time Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Default_Transition_Time Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_default_transition_time_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_DEFAULT_TRANSITION_TIME_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to get default transition time
+
+ \par Description
+ This is to get default transition time.
+
+ \param [out] default_time Default Transition Time.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_default_transition_time_server_get_time
+(
+ /* OUT */ MS_STATE_GENERIC_DEFAULT_TRANSITION_TIME_STRUCT* default_time
+);
+/** \} */
+
+/**
+ \defgroup generic_default_transition_time_cli_api_defs Generic Default Transition Time Client API Definitions
+ \{
+ This section describes the Generic Default Transition Time Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Default_Transition_Time Client model
+
+ \par Description
+ This is to initialize Generic_Default_Transition_Time Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Default_Transition_Time Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_default_transition_time_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_DEFAULT_TRANSITION_TIME_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Default_Transition_Time client model handle
+
+ \par Description
+ This is to get the handle of Generic_Default_Transition_Time client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_default_transition_time_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_default_transition_time_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Generic Default Transition Time state of an element.
+
+ \par Description
+ Generic Default Transition Time Get is an acknowledged message used to get
+ the Generic Default Transition Time state of an element.
+ The response to the Generic Default Transition Time Get message is a Generic Default
+ Transition Time Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_default_transition_time_get() \
+ MS_generic_default_transition_time_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_DEFAULT_TRANSITION_TIME_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_DEFAULT_TRANSITION_TIME_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Default Transition Time state of an element.
+
+ \par Description
+ Generic Default Transition Time Set is an acknowledged message used to set
+ the Generic Default Transition Time state of an element.
+ The response to the Generic Default Transition Time Set message is a Generic Default
+ Transition Time Status message.
+
+ \param [in] param Transition Time
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_default_transition_time_set(param) \
+ MS_generic_default_transition_time_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_DEFAULT_TRANSITION_TIME_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_DEFAULT_TRANSITION_TIME_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Default Transition Time state of an element.
+
+ \par Description
+ Generic Default Transition Time Set Unacknowledged is an unacknowledged message used to set
+ the Generic Default Transition Time state of an element.
+
+ \param [in] param Transition Time
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_default_transition_time_set_unacknowledged(param) \
+ MS_generic_default_transition_time_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_DEFAULT_TRANSITION_TIME_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_DEFAULT_TRANSITION_TIME_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_level_api.h b/src/components/ethermind/mesh/export/include/MS_generic_level_api.h
new file mode 100644
index 0000000..160152e
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_level_api.h
@@ -0,0 +1,487 @@
+/**
+ \file MS_generic_level_api.h
+
+ \brief This file defines the Mesh Generic Level Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_LEVEL_API_
+#define _H_MS_GENERIC_LEVEL_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_level_module GENERIC_LEVEL (Mesh Generic Level Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_level_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Level Server application Asynchronous Notification Callback.
+
+ Generic Level Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_LEVEL_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Level Client application Asynchronous Notification Callback.
+
+ Generic Level Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_LEVEL_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_level_structures Structures
+ \{
+*/
+
+/**
+ Generic Level Set message parameters
+*/
+typedef struct MS_generic_level_set_struct
+{
+ /**
+ The target value of the Generic Level state.
+
+ The Generic Level state is a 16-bit signed integer (2s complement) representing
+ the state of an element.
+ */
+ UINT16 level;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_LEVEL_SET_STRUCT;
+
+/**
+ Generic Level Status message parameters
+*/
+typedef struct MS_generic_level_status_struct
+{
+ /** The present value of the Generic Level state. */
+ UINT16 present_level;
+
+ /** The target value of the Generic Level state */
+ UINT16 target_level;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Level and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_LEVEL_STATUS_STRUCT;
+
+/**
+ Generic Delta Set message parameters.
+*/
+typedef struct MS_generic_delta_set_struct
+{
+ /** The Delta change of the Generic Level state */
+ UINT32 delta_level;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_DELTA_SET_STRUCT;
+
+/**
+ Generic Move Set message parameters.
+*/
+typedef struct MS_generic_move_set_struct
+{
+ /** The Delta Level step to calculate Move speed for the Generic Level state. */
+ UINT16 delta_level;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_MOVE_SET_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_level_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Level Model APIs.
+*/
+/**
+ \defgroup generic_level_ser_api_defs Generic Level Server API Definitions
+ \{
+ This section describes the Generic Level Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Level Server model
+
+ \par Description
+ This is to initialize Generic_Level Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Level Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_level_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_LEVEL_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_level_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_level_cli_api_defs Generic Level Client API Definitions
+ \{
+ This section describes the Generic Level Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Level Client model
+
+ \par Description
+ This is to initialize Generic_Level Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Level Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_level_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_LEVEL_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Level client model handle
+
+ \par Description
+ This is to get the handle of Generic_Level client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_level_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_level_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Generic Level state of an element.
+
+ \par Description
+ Generic Level Get is an acknowledged message used to get the Generic Level state of an element.
+ The response to the Generic Level Get message is a Generic Level Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_level_get() \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LEVEL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Level state of an element to a new absolute value.
+
+ \par Description
+ Generic Level Set is an acknowledged message used to set the Generic Level state of an element
+ to a new absolute value.
+ The response to the Generic Level Set message is a Generic Level Status message.
+
+ \param [in] param Generic Level Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_level_set(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LEVEL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Level state of an element to a new absolute value.
+
+ \par Description
+ Generic Level Set Unacknowledged is an unacknowledged message used to set
+ the Generic Level state of an element to a new absolute value.
+
+ \param [in] param Generic Level Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_level_set_unacknowledged(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LEVEL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to set the Generic Level state of an element by a relative value.
+
+ \par Description
+ Generic Delta Set is an acknowledged message used to set the Generic Level state of an element
+ by a relative value. The message is transactional, it supports changing the state by a cumulative
+ value with a sequence of messages that are part of a transaction.
+ The response to the Generic Delta Set message is a Generic Level Status message.
+
+ \param [in] param Generic Delta Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_delta_set(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_DELTA_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Level state of an element by a relative value.
+
+ \par Description
+ Generic Delta Set Unacknowledged is an unacknowledged message used to set the Generic Level state of an element
+ by a relative value.
+
+ \param [in] param Generic Delta Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_delta_set_unacknowledged(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_DELTA_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to start a process of changing the Generic Level state of an element
+ with a defined transition speed.
+
+ \par Description
+ Generic Move Set is an acknowledged message used to start a process of changing
+ the Generic Level state of an element with a defined transition speed.
+ The response to the Generic Move Set message is a Generic Level Status message.
+
+ \param [in] param Generic Move Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_move_set(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MOVE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to start a process of changing the Generic Level state of an element
+ with a defined transition speed.
+
+ \par Description
+ Generic Move Set Unacknowledged is an unacknowledged message used to start a process
+ of changing the Generic Level state of an element with a defined transition speed.
+
+ \param [in] param Generic Move Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_move_set_unacknowledged(param) \
+ MS_generic_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MOVE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_LEVEL_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_location_api.h b/src/components/ethermind/mesh/export/include/MS_generic_location_api.h
new file mode 100644
index 0000000..7b44f28
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_location_api.h
@@ -0,0 +1,517 @@
+/**
+ \file MS_generic_location_api.h
+
+ \brief This file defines the Mesh Generic Location Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_LOCATION_API_
+#define _H_MS_GENERIC_LOCATION_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_location_module GENERIC_LOCATION (Mesh Generic Location Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_location_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Location Server application Asynchronous Notification Callback.
+
+ Generic Location Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_LOCATION_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Location Client application Asynchronous Notification Callback.
+
+ Generic Location Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_LOCATION_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+
+/**
+ Generic Location Setup Server application Asynchronous Notification Callback.
+
+ Generic Location Setup Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_LOCATION_SETUP_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+/** \} */
+
+
+/**
+ \defgroup generic_location_structures Structures
+ \{
+*/
+
+/**
+ Generic Location Global Set message parameters.
+*/
+typedef struct MS_generic_location_global_struct
+{
+ /**
+ Global Coordinates (Latitude).
+ The Global Latitude field describes the global WGS84 North coordinate of the element.
+ */
+ UINT32 global_latitude;
+
+ /**
+ Global Coordinates (Longitude).
+ The Global Longitude field describes the global WGS84 East coordinate of the element.
+ */
+ UINT32 global_longitude;
+
+ /**
+ Global Altitude.
+ The Global Altitude field determines the altitude of the device above the WGS84 datum.
+ It expresses the altitude beyond the WGS84 ellipsoid of the element that exposed its position.
+
+ Value | Description
+ --------------|------------
+ 0x7FFF | Global Altitude is not configured.
+ 0x7FFE | Global Altitude is greater than or equal to 32766 meters.
+ 0x8000-0x7FFD | Global Altitude is (field value) from -32768 meters through 32765 meters.
+ */
+ UINT16 global_altitude;
+
+} MS_GENERIC_LOCATION_GLOBAL_STRUCT;
+
+/**
+ Generic Location Local Set message parameters.
+*/
+typedef struct MS_generic_location_local_struct
+{
+ /**
+ Local Coordinates (North).
+ The Local North field describes the North coordinate of the device using a local coordinate system.
+ It is relative to the north orientation on a predefined map.
+
+ The Local North value is encoded in decimeters and has a range of -32767 decimeters through 32767 decimeters.
+ The value 0x8000 means the Local North information is not configured.
+ */
+ UINT16 local_north;
+
+ /**
+ Local Coordinates (East).
+ The Local East field describes the East coordinate of the device using a local coordinate system.
+ It is relative to the east orientation of a predefined map.
+
+ The Local East value is encoded decimeters and it ranges from -32767 decimeters through 32767 decimeters.
+ The value 0x8000 means the Local East information is not configured.
+ */
+ UINT16 local_east;
+
+ /**
+ Local Altitude.
+ The Local Altitude field determines the altitude of the device relative to the Generic Location Global Altitude.
+
+ Value | Description
+ --------------|------------
+ 0x7FFF | Local Altitude is not configured.
+ 0x7FFE | Local Altitude is greater than or equal to 32766 meters.
+ 0x8000-0x7FFD | Local Altitude is (field value) from -32768 meters through 32765 meters.
+ */
+ UINT16 local_altitude;
+
+ /**
+ Floor Number.
+
+ The Floor Number field describes the floor number where the element is installed.
+ The floor number, N, is encoded as X = N + 20, where X is the encoded floor number.
+ Floor number = -20 (X=0) has a special meaning, indicating the floor -20, and also any floor below that.
+ Floor number = 232 (X=252) has a special meaning, indicating the floor 232, and also any floor above that.
+
+ Encoded Value X | Floor number N
+ ----------------|---------------
+ 0x00 | Floor -20 or any floor below -20.
+ 0x01-0xFB | Floor number N, encoded as X = N + 20.
+ 0xFC | Floor 232 or any floor above 232.
+ 0xFD | Ground floor. Floor 0.
+ 0xFE | Ground floor. Floor 1.
+ 0xFF | Not configured
+
+ Note: The reason for having two definitions of ground floor (0 or 1) is to allow for
+ different conventions applicable in different countries.
+ */
+ UCHAR floor_number;
+
+ /**
+ Uncertainty.
+ The Uncertainty field is a 16-bit bit field that describes the uncertainty of
+ the location information the element exposes.
+
+ bits | Field | Description
+ ------|-------------|------------
+ 0 | Stationary | This bit indicates whether the device broadcasting the location information
+ has a stationary location or is mobile. (0 = Stationary, 1 = Mobile)
+ 1-7 | RFU | Reserved for Future Use
+ 8-11 | Update Time | This value (x) is a 4-bit value ranging from 0 through 15.
+ It represents the time (t) elapsed since the last update of the device's position,
+ measured in seconds using the following formula: t=2^(x-3)
+ The represented range is from 0.125 seconds through 4096 seconds.
+ Note: If 'stationary' is set, this value can be ignored.
+ 12-15 | Precision | This value (y) is a 4-bit value ranging from 0 through 15.
+ It represents a location precision with the formula: Precision = 2^(y-3)
+ The represented range is from 0.125 meters through 4096 meters.
+ */
+ UINT16 uncertainty;
+
+} MS_GENERIC_LOCATION_LOCAL_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_location_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Location Model APIs.
+*/
+/**
+ \defgroup generic_location_ser_api_defs Generic Location Server API Definitions
+ \{
+ This section describes the Generic Location Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Location Server model
+
+ \par Description
+ This is to initialize Generic_Location Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Location Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_LOCATION_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to initialize Generic_Location_Setup Server model
+
+ \par Description
+ This is to initialize Generic_Location_Setup Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Location_Setup Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_setup_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_LOCATION_SETUP_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_setup_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_location_cli_api_defs Generic Location Client API Definitions
+ \{
+ This section describes the Generic Location Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Location Client model
+
+ \par Description
+ This is to initialize Generic_Location Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Location Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_LOCATION_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Location client model handle
+
+ \par Description
+ This is to get the handle of Generic_Location client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_location_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Global Get message is an acknowledged message used to get the selected fields
+ of the Generic Location state of an element.
+ The response to the Generic Location Global Get message is a Generic Location Global Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_global_get() \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_GLOBAL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_LOCATION_GLOBAL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Global Set is an acknowledged message used to set the selected fields of the Generic Location state of an element.
+ The response to the Generic Location Global Set message is a Generic Location Global Status message.
+
+ \param [in] param Generic Location Global Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_global_set(param) \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_GLOBAL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_LOCATION_GLOBAL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Global Set Unacknowledged is an unacknowledged message used to set the selected fields
+ of the Generic Location state of an element.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_global_set_unacknowledged(param) \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_GLOBAL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Local Get message is an acknowledged message used to get the selected fields
+ of the Generic Location state of an element.
+ The response to the Generic Location Local Get message is a Generic Location Local Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_local_get() \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_LOCAL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_LOCATION_LOCAL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Local Set is an acknowledged message used to set the selected fields
+ of the Generic Location state of an element.
+ The response to the Generic Location Local Set message is a Generic Location Local Status message.
+
+ \param [in] param Generic Location Local Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_local_set(param) \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_LOCAL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_LOCATION_LOCAL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the selected fields of the Generic Location state of an element.
+
+ \par Description
+ Generic Location Local Set Unacknowledged is an unacknowledged message used to set the selected fields
+ of the Generic Location state of an element.
+
+ \param [in] param Generic Location Local Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_location_local_set_unacknowledged(param) \
+ MS_generic_location_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_LOCATION_LOCAL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_LOCATION_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_onoff_api.h b/src/components/ethermind/mesh/export/include/MS_generic_onoff_api.h
new file mode 100644
index 0000000..f67b528
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_onoff_api.h
@@ -0,0 +1,337 @@
+/**
+ \file MS_generic_onoff_api.h
+
+ \brief This file defines the Mesh Generic Onoff Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_ONOFF_API_
+#define _H_MS_GENERIC_ONOFF_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_onoff_module GENERIC_ONOFF (Mesh Generic Onoff Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_onoff_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Onoff Server application Asynchronous Notification Callback.
+
+ Generic Onoff Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_ONOFF_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Onoff Client application Asynchronous Notification Callback.
+
+ Generic Onoff Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_ONOFF_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_onoff_structures Structures
+ \{
+*/
+
+/**
+ Generic OnOff Set message parameters.
+*/
+typedef struct MS_generic_onoff_set_struct
+{
+ /** The target value of the Generic OnOff state */
+ UCHAR onoff;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_ONOFF_SET_STRUCT;
+
+/**
+ Generic OnOff Status message parameters.
+*/
+typedef struct MS_generic_onoff_status_struct
+{
+ /** The present value of the Generic OnOff state. */
+ UCHAR present_onoff;
+
+ /** The target value of the Generic OnOff state */
+ UCHAR target_onoff;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target OnOff and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_ONOFF_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_onoff_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Onoff Model APIs.
+*/
+/**
+ \defgroup generic_onoff_ser_api_defs Generic Onoff Server API Definitions
+ \{
+ This section describes the Generic Onoff Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Onoff Server model
+
+ \par Description
+ This is to initialize Generic_Onoff Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Onoff Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_onoff_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_ONOFF_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_onoff_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_onoff_cli_api_defs Generic Onoff Client API Definitions
+ \{
+ This section describes the Generic Onoff Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Onoff Client model
+
+ \par Description
+ This is to initialize Generic_Onoff Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Onoff Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_onoff_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_ONOFF_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Onoff client model handle
+
+ \par Description
+ This is to get the handle of Generic_Onoff client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_onoff_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_onoff_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get Generic OnOff state
+
+ \par Description
+ The Generic OnOff Get is an acknowledged message used to get the Generic OnOff
+ state of an element.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onoff_get() \
+ MS_generic_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONOFF_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_ONOFF_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set Generic OnOff state
+
+ \par Description
+ The Generic OnOff Set is an acknowledged message used to get the Generic OnOff
+ state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref MS_GENERIC_ONOFF_SET_STRUCT
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onoff_set(param) \
+ MS_generic_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONOFF_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_ONOFF_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set Generic OnOff state unacknowledged
+
+ \par Description
+ The Generic OnOff Set is an unacknowledged message used to get the Generic OnOff
+ state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref MS_GENERIC_ONOFF_SET_STRUCT
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onoff_set_unacknowledged(param) \
+ MS_generic_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONOFF_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_ONOFF_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_power_level_api.h b/src/components/ethermind/mesh/export/include/MS_generic_power_level_api.h
new file mode 100644
index 0000000..490670f
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_power_level_api.h
@@ -0,0 +1,594 @@
+/**
+ \file MS_generic_power_level_api.h
+
+ \brief This file defines the Mesh Generic Power Level Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_POWER_LEVEL_API_
+#define _H_MS_GENERIC_POWER_LEVEL_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_power_level_module GENERIC_POWER_LEVEL (Mesh Generic Power Level Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_power_level_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Power Level Server application Asynchronous Notification Callback.
+
+ Generic Power Level Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_LEVEL_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Power Level Client application Asynchronous Notification Callback.
+
+ Generic Power Level Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_LEVEL_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+
+/**
+ Generic Power Level Setup Server application Asynchronous Notification Callback.
+
+ Generic Power Level Setup Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_LEVEL_SETUP_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_power_level_structures Structures
+ \{
+*/
+
+/**
+ Generic Power Level Set message parameters.
+*/
+typedef struct MS_generic_power_level_set_struct
+{
+ /** The target value of the Generic Power Actual state */
+ UINT16 power;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_POWER_LEVEL_SET_STRUCT;
+
+/**
+ Generic Power Level Status message parameters.
+*/
+typedef struct MS_generic_power_level_status_struct
+{
+ /** The present value of the Generic Power Actual state. */
+ UINT16 present_power;
+
+ /** The target value of the Generic Power Actual state. */
+ UINT16 target_power;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Power and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_POWER_LEVEL_STATUS_STRUCT;
+
+/**
+ Generic Power Last Status message parameters.
+*/
+typedef struct MS_generic_power_last_status_struct
+{
+ /** The value of the Generic Power Last state. */
+ UINT16 power;
+
+} MS_GENERIC_POWER_LAST_STATUS_STRUCT;
+
+/**
+ Generic Power Default Status message parameters.
+*/
+typedef struct MS_generic_power_default_status_struct
+{
+ /** The value of the Generic Power Default state. */
+ UINT16 power;
+
+} MS_GENERIC_POWER_DEFAULT_STATUS_STRUCT;
+
+/**
+ Generic Power Range Status message parameters.
+*/
+typedef struct MS_generic_power_range_status_struct
+{
+ /** Status Code for the requesting message. */
+ UCHAR status;
+
+ /** The value of the Generic Power Range Min field of the Generic Power Range state. */
+ UINT16 range_min;
+
+ /** The value of the Generic Power Range Max field of the Generic Power Range state. */
+ UINT16 range_max;
+
+} MS_GENERIC_POWER_RANGE_STATUS_STRUCT;
+
+/**
+ Generic Power Default Status message parameters.
+*/
+typedef struct MS_generic_power_default_set_struct
+{
+ /** The value of the Generic Power Default state. */
+ UINT16 power;
+
+} MS_GENERIC_POWER_DEFAULT_SET_STRUCT;
+
+/**
+ Generic Power Range Set message parameters.
+*/
+typedef struct MS_generic_power_range_set_struct
+{
+ /** The value of the Generic Power Min field of the Generic Power Range state. */
+ UINT16 range_min;
+
+ /** The value of the Generic Power Range Max field of the Generic Power Range state. */
+ UINT16 range_max;
+
+} MS_GENERIC_POWER_RANGE_SET_STRUCT;
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_power_level_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Power Level Model APIs.
+*/
+/**
+ \defgroup generic_power_level_ser_api_defs Generic Power Level Server API Definitions
+ \{
+ This section describes the Generic Power Level Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Power_Level Server model
+
+ \par Description
+ This is to initialize Generic_Power_Level Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Level Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_LEVEL_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to initialize Generic_Power_Level_Setup Server model
+
+ \par Description
+ This is to initialize Generic_Power_Level_Setup Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Level_Setup Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_setup_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_LEVEL_SETUP_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_setup_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_power_level_cli_api_defs Generic Power Level Client API Definitions
+ \{
+ This section describes the Generic Power Level Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Power_Level Client model
+
+ \par Description
+ This is to initialize Generic_Power_Level Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Level Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_LEVEL_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Power_Level client model handle
+
+ \par Description
+ This is to get the handle of Generic_Power_Level client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_level_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Generic Power Actual state of an element.
+
+ \par Description
+ Generic Power Level Get message is an acknowledged message used to get the Generic Power Actual state of an element.
+ The response to the Generic Power Level Get message is a Generic Power Level Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_level_get() \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_LEVEL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_POWER_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Actual state of an element.
+
+ \par Description
+ Generic Power Level Set is an acknowledged message used to set the Generic Power Actual state of an element.
+ The response to the Generic Power Level Set message is a Generic Power Level Status message.
+
+ \param [in] param Generic Power Level Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_level_set(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_LEVEL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_POWER_LEVEL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Actual state of an element.
+
+ \par Description
+ Generic Power Level Set Unacknowledged is an unacknowledged message used
+ to set the Generic Power Actual state of an element.
+
+ \param [in] param Generic Power Level Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_level_set_unacknowledged(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_LEVEL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Generic Power Last state of an element.
+
+ \par Description
+ Generic Power Last Get is an acknowledged message used to get the Generic Power Last state of an element.
+ The response to a Generic Power Last Get message is a Generic Power Last Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_last_get() \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_LAST_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_POWER_LAST_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Generic Power Default state of an element.
+
+ \par Description
+ Generic Power Default Get is an acknowledged message used to get the Generic Power Default state of an element.
+ The response to a Generic Power Default Get message is a Generic Power Default Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_default_get() \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_DEFAULT_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_POWER_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Default state of an element.
+
+ \par Description
+ Generic Power Default Set is an acknowledged message used to set the Generic Power Default state of an element.
+ The response to the Generic Power Default Set message is a Generic Power Default Status message.
+
+ \param [in] param Generic Power Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_default_set(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_DEFAULT_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_POWER_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Default state of an element.
+
+ \par Description
+ Generic Power Default Set Unacknowledged is an unacknowledged message used to set
+ the Generic Power Default state of an element.
+
+ \param [in] param Generic Power Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_default_set_unacknowledged(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_DEFAULT_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Generic Power Range state of an element.
+
+ \par Description
+ Generic Power Range Get is an acknowledged message used to get the Generic Power Range state of an element.
+ The response to the Generic Power Range Get message is a Generic Power Range Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_range_get() \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_RANGE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_POWER_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Range state of an element.
+
+ \par Description
+ Generic Power Range Set is an acknowledged message used to set the Generic Power Range state of an element.
+ The response to the Generic Power Range Set message is a Generic Power Range Status message.
+
+ \param [in] param Generic Power Range Set message`
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_range_set(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_RANGE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_POWER_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Power Range state of an element.
+
+ \par Description
+ Generic Power Range Set Unacknowledged is an unacknowledged message used to set
+ the Generic Power Range state of an element.
+
+ \param [in] param Generic Power Range Set message`
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_power_range_set_unacknowledged(param) \
+ MS_generic_power_level_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_POWER_RANGE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /* _H_MS_GENERIC_POWER_LEVEL_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_power_onoff_api.h b/src/components/ethermind/mesh/export/include/MS_generic_power_onoff_api.h
new file mode 100644
index 0000000..d931dfd
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_power_onoff_api.h
@@ -0,0 +1,365 @@
+/**
+ \file MS_generic_power_onoff_api.h
+
+ \brief This file defines the Mesh Generic Power Onoff Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_POWER_ONOFF_API_
+#define _H_MS_GENERIC_POWER_ONOFF_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_power_onoff_module GENERIC_POWER_ONOFF (Mesh Generic Power Onoff Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_power_onoff_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Power Onoff Server application Asynchronous Notification Callback.
+
+ Generic Power Onoff Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_ONOFF_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Power Onoff Client application Asynchronous Notification Callback.
+
+ Generic Power Onoff Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_ONOFF_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+
+/**
+ Generic Power Onoff Setup Server application Asynchronous Notification Callback.
+
+ Generic Power Onoff Setup Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_POWER_ONOFF_SETUP_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_power_onoff_structures Structures
+ \{
+*/
+
+/**
+ Generic OnPowerUp Set message parameters.
+*/
+typedef struct MS_generic_onpowerup_struct
+{
+ /**
+ The Generic OnPowerUp state is an enumeration representing the behavior of an element when powered up.
+
+ Value | Description
+ ----------|------------
+ 0x00 | Off. After being powered up, the element is in an off state.
+ 0x01 | Default. After being powered up, the element is in an On state and uses default state values.
+ 0x02 | Restore. If a transition was in progress when powered down, the element restores the target
+ state when powered up. Otherwise the element restores the state it was in when powered down.
+ 0x03-0xFF | Prohibited
+ */
+ UCHAR onpowerup;
+
+} MS_GENERIC_ONPOWERUP_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_power_onoff_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Power Onoff Model APIs.
+*/
+/**
+ \defgroup generic_power_onoff_ser_api_defs Generic Power Onoff Server API Definitions
+ \{
+ This section describes the Generic Power Onoff Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Power_Onoff Server model
+
+ \par Description
+ This is to initialize Generic_Power_Onoff Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Onoff Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_ONOFF_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to initialize Generic_Power_Onoff_Setup Server model
+
+ \par Description
+ This is to initialize Generic_Power_Onoff_Setup Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Onoff_Setup Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_setup_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_ONOFF_SETUP_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_setup_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup generic_power_onoff_cli_api_defs Generic Power Onoff Client API Definitions
+ \{
+ This section describes the Generic Power Onoff Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Power_Onoff Client model
+
+ \par Description
+ This is to initialize Generic_Power_Onoff Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Power_Onoff Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_POWER_ONOFF_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Power_Onoff client model handle
+
+ \par Description
+ This is to get the handle of Generic_Power_Onoff client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_power_onoff_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Generic OnPowerUp state of an element.
+
+ \par Description
+ Generic OnPowerUp Get is an acknowledged message used to get the Generic OnPowerUp state of an element.
+ The response to the Generic OnPowerUp Get message is a Generic OnPowerUp Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onpowerup_get() \
+ MS_generic_power_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONPOWERUP_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_ONPOWERUP_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic OnPowerUp state of an element.
+
+ \par Description
+ Generic OnPowerUp Set is an acknowledged message used to set the Generic OnPowerUp state of an element.
+ The response to the Generic OnPowerUp Set message is a Generic OnPowerUp Status message.
+
+ \param [in] param Generic OnPowerUp Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onpowerup_set(param) \
+ MS_generic_power_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONPOWERUP_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_ONPOWERUP_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic OnPowerUp state of an element.
+
+ \par Description
+ Generic OnPowerUp Set Unacknowledged is an unacknowledged message used to set
+ the Generic OnPowerUp state of an element.
+
+ \param [in] param Generic OnPowerUp Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_onpowerup_set_unacknowledged(param) \
+ MS_generic_power_onoff_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ONPOWERUP_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /* _H_MS_GENERIC_POWER_ONOFF_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_generic_property_api.h b/src/components/ethermind/mesh/export/include/MS_generic_property_api.h
new file mode 100644
index 0000000..7e35787
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_generic_property_api.h
@@ -0,0 +1,910 @@
+/**
+ \file MS_generic_property_api.h
+
+ \brief This file defines the Mesh Generic User, Admin, Manufacturer and Client Property Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_GENERIC_PROPERTY_API_
+#define _H_MS_GENERIC_PROPERTY_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup generic_property_module GENERIC_PROPERTY (Mesh Generic Property Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic Property Model (GENERIC_PROPERTY) module to the Application.
+*/
+
+/** Generic Manufacturer Properties */
+#define MS_GENERIC_PROP_TYPE_MANUFACTURER 0x00
+
+/** Generic Admin Properties */
+#define MS_GENERIC_PROP_TYPE_ADMIN 0x01
+
+/** Generic User Properties */
+#define MS_GENERIC_PROP_TYPE_USER 0x02
+
+/** User Access field values */
+/** User Access - Prohibited */
+#define MS_GENERIC_USER_ACCESS_PROHIBITED 0x00
+/** User Access - the device property can be read */
+#define MS_GENERIC_USER_ACCESS_READ 0x01
+/** User Access - the device property can be written */
+#define MS_GENERIC_USER_ACCESS_WRITE 0x02
+/** User Access - the device property can be read and written */
+#define MS_GENERIC_USER_ACCESS_READ_WRITE 0x03
+
+#define MS_GENERIC_USER_ACCESS_INVALID_PROPERTY_ID 0xFF
+
+/** Device Property - Light Control Time Occupancy Delay */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_OCCUPANCY_DELAY 0x003A
+
+/** Device Property - Light Control Time Fade On */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_FADE_ON 0x0037
+
+/** Device Property - Light Control Time Run On */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_RUN_ON 0x003C
+
+/** Device Property - Light Control Time Fade */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_FADE 0x0036
+
+/** Device Property - Light Control Time Prolong */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_PROLONG 0x003B
+
+/** Device Property - Light Control Time Fade Standby Auto */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_FADE_STANDBY_AUTO 0x0038
+
+/** Device Property - Light Control Time Fade Standby Manual */
+#define MS_DEV_PROP_LIGHT_CONTROL_TIME_FADE_STANDBY_MANUAL 0x0039
+
+/** Device Property - Light Control Lightness On */
+#define MS_DEV_PROP_LIGHT_CONTROL_LIGHTNESS_ON 0x002E
+
+/** Device Property - Light Control Lightness Prolong */
+#define MS_DEV_PROP_LIGHT_CONTROL_LIGHTNESS_PROLONG 0x002F
+
+/** Device Property - Light Control Lightness Standby */
+#define MS_DEV_PROP_LIGHT_CONTROL_LIGHTNESS_STANDBY 0x0030
+
+/** Device Property - Light Control Ambient LuxLevel On */
+#define MS_DEV_PROP_LIGHT_CONTROL_AMBIENT_LUXLEVEL_ON 0x002B
+
+/** Device Property - Light Control Ambient LuxLevel Prolong */
+#define MS_DEV_PROP_LIGHT_CONTROL_AMBIENT_LUXLEVEL_PROLONG 0x002C
+
+/** Device Property - Light Control Ambient LuxLevel Standby */
+#define MS_DEV_PROP_LIGHT_CONTROL_AMBIENT_LUXLEVEL_STANDBY 0x002D
+
+/** Device Property - Light Control Regulator Kiu */
+#define MS_DEV_PROP_LIGHT_CONTROL_REGULATOR_KIU 0x0033
+
+/** Device Property - Light Control Regulator Kid */
+#define MS_DEV_PROP_LIGHT_CONTROL_REGULATOR_KID 0x0032
+
+/** Device Property - Light Control Regulator Kpu */
+#define MS_DEV_PROP_LIGHT_CONTROL_REGULATOR_KPU 0x0035
+
+/** Device Property - Light Control Regulator Kpd */
+#define MS_DEV_PROP_LIGHT_CONTROL_REGULATOR_KPD 0x0034
+
+/** Device Property - Light Control Regulator Accuracy */
+#define MS_DEV_PROP_LIGHT_CONTROL_REGULATOR_ACCURACY 0x0031
+
+/** Device Property - Motion Sensed */
+#define MS_DEV_PROP_MOTION_SENSED 0x0042
+
+/** Device Property - Time Since Motion Sensed */
+#define MS_DEV_PROP_TIME_SINCE_MOTION_SENSED 0x0068
+
+/** Device Property - People Count */
+#define MS_DEV_PROP_PEOPLE_COUNT 0x004C
+
+/** Device Property - Presence Detected */
+#define MS_DEV_PROP_PRESENCE_DETECTED 0x004D
+
+/** Device Property - Present Ambient Light Level */
+#define MS_DEV_PROP_PRESENT_AMBIENT_LIGHT_LEVEL 0x004E
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup generic_property_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Generic Property Server application Asynchronous Notification Callback.
+
+ Generic Property Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_GENERIC_PROPERTY_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Generic Property Client application Asynchronous Notification Callback.
+
+ Generic Property Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_GENERIC_PROPERTY_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup generic_property_structures Structures
+ \{
+*/
+
+/**
+ Generic User Properties Status message parameters.
+*/
+typedef struct MS_generic_user_properties_status_struct
+{
+ /**
+ A sequence of N User Property IDs present within an element,
+ where N is the number of device property IDs included in the message.
+ */
+ UINT16* user_property_ids;
+
+ /** Number of User Property IDs */
+ UINT16 user_property_ids_count;
+
+} MS_GENERIC_USER_PROPERTIES_STATUS_STRUCT;
+
+/**
+ Generic User Property Get message parameters.
+*/
+typedef struct MS_generic_user_property_get_struct
+{
+ /** Property ID identifying a Generic User Property. */
+ UINT16 user_property_id;
+
+} MS_GENERIC_USER_PROPERTY_GET_STRUCT;
+
+/**
+ Generic User Property Set message parameters.
+*/
+typedef struct MS_generic_user_property_set_struct
+{
+ /** Property ID identifying a Generic User Property */
+ UINT16 user_property_id;
+
+ /** Raw value for the User Property */
+ UCHAR* user_property_value;
+
+ /** Raw value length for the User Property */
+ UINT16 user_property_value_len;
+
+} MS_GENERIC_USER_PROPERTY_SET_STRUCT;
+
+/**
+ Generic User Property Status message parameters.
+*/
+typedef struct MS_generic_user_property_status_struct
+{
+ /** Property ID identifying a Generic User Property. */
+ UINT16 user_property_id;
+
+ /** Enumeration indicating user access. */
+ UCHAR user_access;
+
+ /** Raw value for the User Property */
+ UCHAR* user_property_value;
+
+ /** Raw value length for the User Property */
+ UINT16 user_property_value_len;
+
+ /** Flag: To represent if optional fields User Access and Raw Value are valid */
+ UCHAR optional_fields_present;
+
+} MS_GENERIC_USER_PROPERTY_STATUS_STRUCT;
+
+/**
+ Generic Admin Properties Status message parameters.
+*/
+typedef struct MS_generic_admin_properties_status_struct
+{
+ /**
+ A sequence of N Admin Property IDs present within an element,
+ where N is the number of device property IDs included in the message.
+ */
+ UINT16* admin_property_ids;
+
+ /** Number of Admin Property IDs */
+ UINT16 admin_property_ids_count;
+
+} MS_GENERIC_ADMIN_PROPERTIES_STATUS_STRUCT;
+
+/**
+ Generic Admin Property Get message parameters.
+*/
+typedef struct MS_generic_admin_property_get_struct
+{
+ /** Property ID identifying a Generic Admin Property. */
+ UINT16 admin_property_id;
+
+} MS_GENERIC_ADMIN_PROPERTY_GET_STRUCT;
+
+/**
+ Generic Admin Property Set message parameters.
+*/
+typedef struct MS_generic_admin_property_set_struct
+{
+ /** Property ID identifying a Generic Admin Property. */
+ UINT16 admin_property_id;
+
+ /** Enumeration indicating user access. */
+ UCHAR admin_user_access;
+
+ /** Raw value for the Admin Property */
+ UCHAR* admin_property_value;
+
+ /** Raw value length for the Admin Property */
+ UINT16 admin_property_value_len;
+
+} MS_GENERIC_ADMIN_PROPERTY_SET_STRUCT;
+
+/**
+ Generic Admin Property Status message parameters.
+*/
+typedef struct MS_generic_admin_property_status_struct
+{
+ /** Property ID identifying a Generic Admin Property */
+ UINT16 admin_property_id;
+
+ /** Enumeration indicating user access (Optional) */
+ UCHAR admin_user_access;
+
+ /** Raw value for the Admin Property */
+ UCHAR* admin_property_value;
+
+ /** Raw value length for the Admin Property */
+ UINT16 admin_property_value_len;
+
+} MS_GENERIC_ADMIN_PROPERTY_STATUS_STRUCT;
+
+/**
+ Generic Manufacturer Properties Status message parameters.
+*/
+typedef struct MS_generic_manufacturer_properties_status_struct
+{
+ /**
+ A sequence of N Manufacturer Property IDs present within an element,
+ where N is the number of device property IDs included in the message.
+ */
+ UINT16* manufacturer_property_ids;
+
+ /** Number of Manufacturer Property IDs */
+ UINT16 manufacturer_property_ids_count;
+
+} MS_GENERIC_MANUFACTURER_PROPERTIES_STATUS_STRUCT;
+
+/**
+ Generic Manufacturer Property Get message parameters.
+*/
+typedef struct MS_generic_manufacturer_property_get_struct
+{
+ /** Property ID identifying a Generic Manufacturer Property */
+ UINT16 manufacturer_property_id;
+
+} MS_GENERIC_MANUFACTURER_PROPERTY_GET_STRUCT;
+
+/**
+ Generic Manufacturer Property Set message parameters.
+*/
+typedef struct MS_generic_manufacturer_property_set_struct
+{
+ /** Property ID identifying a Generic Manufacturer Property */
+ UINT16 manufacturer_property_id;
+
+ /** Enumeration indicating user access */
+ UCHAR manufacturer_user_access;
+
+} MS_GENERIC_MANUFACTURER_PROPERTY_SET_STRUCT;
+
+/**
+ Generic Manufacturer Property Status message parameters.
+*/
+typedef struct MS_generic_manufacturer_property_status_struct
+{
+ /** Property ID identifying a Generic Manufacturer Property */
+ UINT16 manufacturer_property_id;
+
+ /** Enumeration indicating user access */
+ UCHAR manufacturer_user_access;
+
+ /** Raw value for the Manufacturer Property */
+ UCHAR* manufacturer_property_value;
+
+ /** Raw value length for the Manufacturer Property */
+ UINT16 manufacturer_property_value_len;
+
+} MS_GENERIC_MANUFACTURER_PROPERTY_STATUS_STRUCT;
+
+/**
+ Generic Client Properties Get message parameters.
+*/
+typedef struct MS_generic_client_properties_get_struct
+{
+ /** A starting Client Property ID present within an element */
+ UINT16 client_property_id;
+
+} MS_GENERIC_CLIENT_PROPERTIES_GET_STRUCT;
+
+/**
+ Generic Client Properties Status message parameters.
+*/
+typedef struct MS_generic_client_properties_status_struct
+{
+ /**
+ A sequence of N Client Property IDs present within an element,
+ where N is the number of device property IDs included in the message.
+ */
+ UINT16* client_property_ids;
+
+ /** Number of Client Property IDs */
+ UINT16 client_property_ids_count;
+
+} MS_GENERIC_CLIENT_PROPERTIES_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup generic_property_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Generic Property Model APIs.
+*/
+/**
+ \defgroup generic_user_property_ser_api_defs Generic User Property Server API Definitions
+ \{
+ This section describes the Generic User Property Server APIs.
+*/
+
+/**
+ \brief API to initialize Generic_User_Property Server model
+
+ \par Description
+ This is to initialize Generic_User_Property Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_User_Property Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_user_property_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_PROPERTY_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Generic_Admin_Property Server model
+
+ \par Description
+ This is to initialize Generic_Admin_Property Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Admin_Property Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_admin_property_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_PROPERTY_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Generic_Manufacturer_Property Server model
+
+ \par Description
+ This is to initialize Generic_Manufacturer_Property Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Manufacturer_Property Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_manufacturer_property_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_PROPERTY_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Generic_Client_Property Server model
+
+ \par Description
+ This is to initialize Generic_Client_Property Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Client_Property Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_client_property_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_PROPERTY_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_user_property_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_admin_property_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_manufacturer_property_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_client_property_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/** \} */
+
+/**
+ \defgroup generic_property_cli_api_defs Generic Property Client API Definitions
+ \{
+ This section describes the Generic Property Client APIs.
+*/
+
+/**
+ \brief API to initialize Generic_Property Client model
+
+ \par Description
+ This is to initialize Generic_Property Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Generic_Property Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_property_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_GENERIC_PROPERTY_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Generic_Property client model handle
+
+ \par Description
+ This is to get the handle of Generic_Property client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_property_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_generic_property_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the list of Generic User Property states of an element.
+
+ \par Description
+ Generic User Properties Get is an acknowledged message used to get the list of Generic User Property states of an element.
+ The response to the Generic User Properties Get message is a Generic User Properties Status message.
+ The message has no parameters.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_user_properties_get() \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_USER_PROPERTIES_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_USER_PROPERTIES_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Generic User Property state of an element.
+
+ \par Description
+ Generic User Property Get is an acknowledged message used to get the Generic User Property state of an element.
+ The response to the Generic User Property Get message is a Generic User Property Status message.
+
+ \param [in] param Generic User Property Get message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_user_property_get(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_USER_PROPERTY_GET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_USER_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic User Property state of an element.
+
+ \par Description
+ Generic User Property Set is an acknowledged message used to set the Generic User Property state of an element.
+ The response to the Generic User Property Set message is a Generic User Property Status message.
+
+ \param [in] param Generic User Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_user_property_set(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_USER_PROPERTY_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_USER_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic User Property state of an element.
+
+ \par Description
+ Generic User Property Set Unacknowledged is an unacknowledged message used to set
+ the Generic User Property state of an element.
+
+ \param [in] param Generic User Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_user_property_set_unacknowledged(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_USER_PROPERTY_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the list of Generic Admin Property states of an element.
+
+ \par Description
+ Generic Admin Properties Get is an acknowledged message used to get the list of Generic Admin Property states of an element.
+ The response to the Generic Admin Properties Get message is a Generic Admin Properties Status message.
+ The message has no parameters.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_admin_properties_get() \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTIES_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTIES_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Generic Admin Property state of an element.
+
+ \par Description
+ Generic Admin Property Get is an acknowledged message used to get the Generic Admin Property state of an element.
+ The response to the Generic Admin Property Get message is a Generic Admin Property Status message.
+
+ \param [in] param Generic Admin Property Get message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_admin_property_get(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTY_GET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Admin Property state of an element.
+
+ \par Description
+ Generic Admin Property Set is an acknowledged message used to set the Generic Admin Property state of an element.
+ The response to the Generic Admin Property Set message is a Generic Admin Property Status message.
+
+ \param [in] param Generic Admin Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_admin_property_set(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTY_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Generic Admin Property state of an element.
+
+ \par Description
+ Generic Admin Property Set Unacknowledged is an unacknowledged message used to set
+ the Generic Admin Property state of an element.
+
+ \param [in] param Generic Admin Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_admin_property_set_unacknowledged(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_ADMIN_PROPERTY_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the list of Generic Manufacturer Property states of an element.
+
+ \par Description
+ Generic Manufacturer Properties Get is an acknowledged message used to get
+ the list of Generic Manufacturer Property states of an element.
+ The response to the Generic Manufacturer Properties Get message
+ is a Generic Manufacturer Properties Status message.
+ The message has no parameters.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_manufacturer_properties_get() \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTIES_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTIES_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Generic Manufacturer Property state of an element.
+
+ \par Description
+ Generic Manufacturer Property Get is an acknowledged message used to get the Generic Manufacturer Property state of an element.
+ The response to the Generic Manufacturer Property Get message is a Generic Manufacturer Property Status message.
+
+ \param [in] param Generic Manufacturer Property Get message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_manufacturer_property_get(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTY_GET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to the Generic Manufacturer Property User Access state of an element.
+
+ \par Description
+ Generic Manufacturer Property Set is an acknowledged message used to set the Generic Manufacturer Property User Access state of an element.
+ The response to the Generic Manufacturer Property Set message is a Generic Manufacturer Property Status message.
+
+ \param [in] param Generic Manufacturer Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_manufacturer_property_set(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTY_SET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to the Generic Manufacturer Property User Access state of an element.
+
+ \par Description
+ The Generic Manufacturer Property Set Unacknowledged is an unacknowledged message used to set the Generic Manufacturer Property User Access state of an element.
+
+ \param [in] param Generic Manufacturer Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_manufacturer_property_set_unacknowledged(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_MANUFACTURER_PROPERTY_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the list of Generic Client Property states of an element.
+
+ \par Description
+ Generic Client Properties Get is an acknowledged message used to get the list of Generic Client Property states of an element.
+ The response to the Generic Client Properties Get message is a Generic Client Properties Status message.
+
+ \param [in] param Generic Client Properties Get message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_generic_client_properties_get(param) \
+ MS_generic_property_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_GENERIC_CLIENT_PROPERTIES_GET_OPCODE,\
+ param,\
+ MS_ACCESS_GENERIC_CLIENT_PROPERTIES_STATUS_OPCODE\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_GENERIC_PROPERTY_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_health_client_api.h b/src/components/ethermind/mesh/export/include/MS_health_client_api.h
new file mode 100644
index 0000000..a5b10d5
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_health_client_api.h
@@ -0,0 +1,421 @@
+/**
+ \file MS_health_client_api.h
+
+ \brief This file defines the Mesh Health Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_HEALTH_CLIENT_API_
+#define _H_MS_HEALTH_CLIENT_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup health_module HEALTH (Mesh Health Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Health Model (HEALTH) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup health_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Health Client application Asynchronous Notification Callback.
+
+ Health Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_HEALTH_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup health_structures Structures
+ \{
+*/
+
+/**
+ Health Status message parameters
+*/
+typedef struct MS_health_status_struct
+{
+ /** Identifier of a performed test */
+ UCHAR test_id;
+
+ /** 16-bit Bluetooth assigned Company Identifier */
+ UINT16 company_id;
+
+ /** The FaultArray field contains a sequence of 1-octet fault values */
+ UCHAR* faultarray;
+
+ /** Number of fault values in the FaultArray */
+ UINT16 faultarray_len;
+
+} MS_HEALTH_STATUS_STRUCT;
+
+/**
+ Health Fault Get clear message parameters
+*/
+typedef struct MS_health_fault_get_clear_struct
+{
+ /** 16-bit Bluetooth assigned Company Identifier */
+ UINT16 company_id;
+
+} MS_HEALTH_FAULT_GET_CLEAR_STRUCT;
+
+/**
+ Health Fault Test message parameters
+*/
+typedef struct MS_health_fault_test_struct
+{
+ /** Identifier of a performed test */
+ UCHAR test_id;
+
+ /** 16-bit Bluetooth assigned Company Identifier */
+ UINT16 company_id;
+
+} MS_HEALTH_FAULT_TEST_STRUCT;
+
+/**
+ Health Period message parameters
+*/
+typedef struct MS_health_period_struct
+{
+ /**
+ Divider for the Publish Period.
+ Modified Publish Period is used for sending Current Health Status messages
+ when there are active faults to communicate.
+ */
+ UCHAR fastperioddivisor;
+
+} MS_HEALTH_PERIOD_STRUCT;
+
+/**
+ Health Attention message parameters
+*/
+typedef struct MS_health_attention_struct
+{
+ /** Value of the Attention Timer state */
+ UCHAR attention;
+
+} MS_HEALTH_ATTENTION_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup health_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Health Model APIs.
+*/
+/**
+ \defgroup health_cli_api_defs Health Client API Definitions
+ \{
+ This section describes the Health Client APIs.
+*/
+
+/**
+ \brief API to initialize Health Client model
+
+ \par Description
+ This is to initialize Health Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Health Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_health_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_HEALTH_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Health client model handle
+
+ \par Description
+ This is to get the handle of Health client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_health_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_health_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to report the registered fault state
+
+ \par Description
+ The Health Fault Get is an acknowledged message used to get the current
+ Registered Fault state identified by Company ID of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_FAULT_GET_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_fault_get(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_FAULT_GET_OPCODE,\
+ param,\
+ MS_ACCESS_HEALTH_FAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to clear the registered fault state
+
+ \par Description
+ The Health Fault Clear Unacknowledged is an unacknowledged message used
+ to clear the current Registered Fault state identified by Company ID of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_FAULT_CLEAR_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_fault_clear_unacknowledged(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_FAULT_CLEAR_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to clear the registered fault state
+
+ \par Description
+ The Health Fault Clear is an acknowledged message used to clear the
+ current Registered Fault state identified by Company ID of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_FAULT_CLEAR_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_fault_clear(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_FAULT_CLEAR_OPCODE,\
+ param,\
+ MS_ACCESS_HEALTH_FAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to invoke a self-test procedure
+
+ \par Description
+ The Health Fault Test is an acknowledged message used to invoke a self-test
+ procedure of an element. The procedure is implementation specific and may
+ result in changing the Health Fault state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_FAULT_TEST_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_fault_test(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_FAULT_TEST_OPCODE,\
+ param,\
+ MS_ACCESS_HEALTH_FAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to invoke a self-test procedure
+
+ \par Description
+ The Health Fault Test Unacknowledged is an unacknowledged message used
+ to invoke a self-test procedure of an element. The procedure is implementation
+ specific and may result in changing the Health Fault state of an element.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_fault_test_unacknowledged(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_FAULT_TEST_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the health period state
+
+ \par Description
+ The Health Period Get is an acknowledged message used to get the
+ current Health Period state of an element.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_period_get() \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_PERIOD_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_HEALTH_PERIOD_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the health period state
+
+ \par Description
+ The Health Period Set Unacknowledged is an unacknowledged message used
+ to set the current Health Period state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_PERIOD_SET_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_period_set_unacknowledged(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_PERIOD_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to set the health period state
+
+ \par Description
+ The Health Period Set is an acknowledged message used to set the
+ current Health Period state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_PERIOD_SET_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_period_set(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_PERIOD_SET_OPCODE,\
+ param,\
+ MS_ACCESS_HEALTH_PERIOD_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the attention state
+
+ \par Description
+ The Health Attention Get is an acknowledged message used to get
+ the current Attention Timer state of an element.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_attention_get() \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_ATTENTION_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_HEALTH_ATTENTION_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the attention state
+
+ \par Description
+ The Health Attention Set is an acknowledged message used to set the
+ Attention Timer state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_ATTENTION_SET_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_attention_set(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_ATTENTION_SET_OPCODE,\
+ param,\
+ MS_ACCESS_HEALTH_ATTENTION_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the attention state
+
+ \par Description
+ The Health Attention Set Unacknowledged is an unacknowledged message
+ used to set the Attention Timer state of an element.
+
+ \param [in] param
+ Pointer to the structure populated as in \ref ACCESS_HEALTH_ATTENTION_SET_PARAM
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_health_attention_set_unacknowledged(param) \
+ MS_health_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_HEALTH_ATTENTION_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /* _H_MS_HEALTH_CLIENT_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_health_server_api.h b/src/components/ethermind/mesh/export/include/MS_health_server_api.h
new file mode 100644
index 0000000..8294f97
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_health_server_api.h
@@ -0,0 +1,276 @@
+/**
+ \file MS_health_server_api.h
+
+ \brief This file defines the Mesh Health Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_HEALTH_SERVER_API_
+#define _H_MS_HEALTH_SERVER_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup health_fault_values Fault Values
+ \{
+ This section lists the Fault Values defined for Health Model.
+*/
+
+/** Health Model - Fault Values */
+/** No Fault */
+#define MS_HEALTH_FAULT_NO_FAULT 0x00
+/** Battery Low Warning */
+#define MS_HEALTH_FAULT_BATTERY_LOW_WARNING 0x01
+/** Battery Low Error */
+#define MS_HEALTH_FAULT_BATTERY_LOW_ERROR 0x02
+/** Supply Voltage Too Low Warning */
+#define MS_HEALTH_FAULT_SUPPLY_VOLTAGE_TOO_LOW_WARNING 0x03
+/** Supply Voltage Too Low Error */
+#define MS_HEALTH_FAULT_SUPPLY_VOLTAGE_TOO_LOW_ERROR 0x04
+/** Supply Voltage Too High Warning */
+#define MS_HEALTH_FAULT_SUPPLY_VOLTAGE_TOO_HIGH_WARNING 0x05
+/** Supply Voltage Too High Error */
+#define MS_HEALTH_FAULT_SUPPLY_VOLTAGE_TOO_HIGH_ERROR 0x06
+/** Power Supply Interrupted Warning */
+#define MS_HEALTH_FAULT_POWER_SUPPLY_INTERRUPTED_WARNING 0x07
+/** Power Supply Interrupted Error */
+#define MS_HEALTH_FAULT_POWER_SUPPLY_INTERRUPTED_ERROR 0x08
+/** No Load Warning */
+#define MS_HEALTH_FAULT_NO_LOAD_WARNING 0x09
+/** No Load Error */
+#define MS_HEALTH_FAULT_NO_LOAD_ERROR 0x0A
+/** Overload Warning */
+#define MS_HEALTH_FAULT_OVERLOAD_WARNING 0x0B
+/** Overload Error */
+#define MS_HEALTH_FAULT_OVERLOAD_ERROR 0x0C
+/** Overheat Warning */
+#define MS_HEALTH_FAULT_OVERHEAT_WARNING 0x0D
+/** Overheat Error */
+#define MS_HEALTH_FAULT_OVERHEAT_ERROR 0x0E
+/** Condensation Warning */
+#define MS_HEALTH_FAULT_CONDENSATION_WARNING 0x0F
+/** Condensation Error */
+#define MS_HEALTH_FAULT_CONDENSATION_ERROR 0x10
+/** Vibration Warning */
+#define MS_HEALTH_FAULT_VIBRATION_WARNING 0x11
+/** Vibration Error */
+#define MS_HEALTH_FAULT_VIBRATION_ERROR 0x12
+/** Configuration Warning */
+#define MS_HEALTH_FAULT_CONFIGURATION_WARNING 0x13
+/** Configuration Error */
+#define MS_HEALTH_FAULT_CONFIGURATION_ERROR 0x14
+/** Element Not Calibrated Warning */
+#define MS_HEALTH_FAULT_ELEMENT_NOT_CALIBRATED_WARNING 0x15
+/** Element Not Calibrated Error */
+#define MS_HEALTH_FAULT_ELEMENT_NOT_CALIBRATED_ERROR 0x16
+/** Memory Warning */
+#define MS_HEALTH_FAULT_MEMORY_WARNING 0x17
+/** Memory Error */
+#define MS_HEALTH_FAULT_MEMORY_ERROR 0x18
+/** Self-Test Warning */
+#define MS_HEALTH_FAULT_SELF_TEST_WARNING 0x19
+/** Self-Test Error */
+#define MS_HEALTH_FAULT_SELF_TEST_ERROR 0x1A
+/** Input Too Low Warning */
+#define MS_HEALTH_FAULT_INPUT_TOO_LOW_WARNING 0x1B
+/** Input Too Low Error */
+#define MS_HEALTH_FAULT_INPUT_TOO_LOW_ERROR 0x1C
+/** Input Too High Warning */
+#define MS_HEALTH_FAULT_INPUT_TOO_HIGH_WARNING 0x1D
+/** Input Too High Error */
+#define MS_HEALTH_FAULT_INPUT_TOO_HIGH_ERROR 0x1E
+/** Input No Change Warning */
+#define MS_HEALTH_FAULT_INPUT_NO_CHANGE_WARNING 0x1F
+/** Input No Change Error */
+#define MS_HEALTH_FAULT_INPUT_NO_CHANGE_ERROR 0x20
+/** Actuator Blocked Warning */
+#define MS_HEALTH_FAULT_ACTUATOR_BLOCKED_WARNING 0x21
+/** Actuator Blocked Error */
+#define MS_HEALTH_FAULT_ACTUATOR_BLOCKED_ERROR 0x22
+/** Housing Opened Warning */
+#define MS_HEALTH_FAULT_HOUSING_OPENED_WARNING 0x23
+/** Housing Opened Error */
+#define MS_HEALTH_FAULT_HOUSING_OPENED_ERROR 0x24
+/** Tamper Warning */
+#define MS_HEALTH_FAULT_TAMPER_WARNING 0x25
+/** Tamper Error */
+#define MS_HEALTH_FAULT_TAMPER_ERROR 0x26
+/** Device Moved Warning */
+#define MS_HEALTH_FAULT_DEVICE_MOVED_WARNING 0x27
+/** Device Moved Error */
+#define MS_HEALTH_FAULT_DEVICE_MOVED_ERROR 0x28
+/** Device Dropped Warning */
+#define MS_HEALTH_FAULT_DEVICE_DROPPED_WARNING 0x29
+/** Device Dropped Error */
+#define MS_HEALTH_FAULT_DEVICE_DROPPED_ERROR 0x2A
+/** Overflow Warning */
+#define MS_HEALTH_FAULT_OVERFLOW_WARNING 0x2B
+/** Overflow Error */
+#define MS_HEALTH_FAULT_OVERFLOW_ERROR 0x2C
+/** Empty Warning */
+#define MS_HEALTH_FAULT_EMPTY_WARNING 0x2D
+/** Empty Error */
+#define MS_HEALTH_FAULT_EMPTY_ERROR 0x2E
+/** Internal Bus Warning */
+#define MS_HEALTH_FAULT_INTERNAL_BUS_WARNING 0x2F
+/** Internal Bus Error */
+#define MS_HEALTH_FAULT_INTERNAL_BUS_ERROR 0x30
+/** Mechanism Jammed Warning */
+#define MS_HEALTH_FAULT_MECHANISM_JAMMED_WARNING 0x31
+/** Mechanism Jammed Error*/
+#define MS_HEALTH_FAULT_MECHANISM_JAMMED_ERROR 0x32
+
+/* 0x33 - 0x7F: Reserved for Future Use */
+/* 0x80 - 0xFF: Vendor Specific Warning / Error */
+
+/** \} */
+
+/**
+ \defgroup health_server_events Health Server Events
+ \{
+ This section lists the Application Events defined for Health Server Model.
+*/
+
+/** Attention Start */
+#define MS_HEALTH_SERVER_ATTENTION_START 0x01
+
+/** Attention Restart */
+#define MS_HEALTH_SERVER_ATTENTION_RESTART 0x02
+
+/** Attention Stop */
+#define MS_HEALTH_SERVER_ATTENTION_STOP 0x03
+
+/** \} */
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \brief Health Server application Asynchronous Notification Callback.
+
+ \par Description
+ Health Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param event_type Health Server Event type.
+ \param event_param Parameter associated with the event if any or NULL.
+ \param param_len Size of the event parameter data. 0 if event param is NULL.
+*/
+typedef API_RESULT (* MS_HEALTH_SERVER_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT8 event_type,
+ UINT8* event_param,
+ UINT16 param_len
+) DECL_REENTRANT;
+
+
+/**
+ Health Server Self Test Function.
+*/
+/* TODO: Add context of the Health Server, so that associated current/registered fault can be updated */
+typedef void (* MS_HEALTH_SERVER_SELF_TEST_FN)(UINT8 test_id, UINT16 company_id);
+
+/**
+ Health Server Self Test Funtion Structure.
+*/
+typedef struct _MS_HEALTH_SERVER_SELF_TEST
+{
+ /** Test ID */
+ UINT8 test_id;
+
+ /** Self Test Function */
+ MS_HEALTH_SERVER_SELF_TEST_FN self_test_fn;
+
+} MS_HEALTH_SERVER_SELF_TEST;
+
+
+/* --------------------------------------------- Function */
+/**
+ \brief API to initialize Health Server model
+
+ \par Description
+ This is to initialize Health Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] company_id
+ Company Identifier
+
+ \param [in] self_tests
+ List of Self Tests that can be run.
+
+ \param [in] num_self_tests
+ Number of Self Tests in the list.
+
+ \param [in] appl_cb Application Callback to be used by the Health Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_health_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ UINT16 company_id,
+ /* IN */ MS_HEALTH_SERVER_SELF_TEST* self_tests,
+ /* IN */ UINT32 num_self_tests,
+ /* IN */ MS_HEALTH_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to report self-test fault
+
+ \par Description
+ This is to report fault observed during self-test procedure.
+
+ \param [in] model_handle
+ Model Handle identifying the Health Server model instance.
+
+ \param [in] test_id
+ Identifier of the self-test
+
+ \param [in] company_id
+ Company Identifier
+
+ \param [in] fault_code
+ Fault value indicating the error.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_health_server_report_fault
+(
+ /* IN */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ UINT8 test_id,
+ /* IN */ UINT16 company_id,
+ /* IN */ UINT8 fault_code
+);
+
+/**
+ \cond ignore_this Ignore this fundtion while generating doxygen document
+*/
+
+API_RESULT MS_health_server_publish_current_status
+(
+ UCHAR* status,
+ UINT16 length
+);
+/**
+ \endcond
+*/
+
+#endif /*_H_MS_HEALTH_SERVER_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_light_ctl_api.h b/src/components/ethermind/mesh/export/include/MS_light_ctl_api.h
new file mode 100644
index 0000000..e6d6543
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_light_ctl_api.h
@@ -0,0 +1,727 @@
+/**
+ \file MS_light_ctl_api.h
+
+ \brief This file defines the Mesh Light Ctl Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LIGHT_CTL_API_
+#define _H_MS_LIGHT_CTL_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup light_ctl_module LIGHT_CTL (Mesh Light Ctl Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup light_ctl_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Light Ctl Server application Asynchronous Notification Callback.
+
+ Light Ctl Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_CTL_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Ctl Temperature Server application Asynchronous Notification Callback.
+
+ Light Ctl Temperature Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_CTL_TEMPERATURE_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Ctl Client application Asynchronous Notification Callback.
+
+ Light Ctl Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_LIGHT_CTL_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup light_ctl_structures Structures
+ \{
+*/
+
+/**
+ Light CTL Set message parameters.
+*/
+typedef struct MS_light_ctl_set_struct
+{
+ /** The target value of the Light CTL Lightness state. */
+ UINT16 ctl_lightness;
+
+ /** The target value of the Light CTL Temperature state. */
+ UINT16 ctl_temperature;
+
+ /** The target value of the Light CTL Delta UV state. */
+ UINT16 ctl_delta_uv;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_CTL_SET_STRUCT;
+
+/**
+ Light CTL Status message parameters.
+*/
+typedef struct MS_light_ctl_status_struct
+{
+ /** The present value of the Light CTL Lightness state */
+ UINT16 present_ctl_lightness;
+
+ /** The present value of the Light CTL Temperature state */
+ UINT16 present_ctl_temperature;
+
+ /** The target value of the Light CTL Lightness state (Optional) */
+ UINT16 target_ctl_lightness;
+
+ /** The target value of the Light CTL Temperature state */
+ UINT16 target_ctl_temperature;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target CTL Lightness and Temperature are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_CTL_STATUS_STRUCT;
+
+/**
+ Light CTL Temperature Set message parameters.
+*/
+typedef struct MS_light_ctl_temperature_set_struct
+{
+ /** The target value of the Light CTL Temperature state. */
+ UINT16 ctl_temperature;
+
+ /** The target value of the Light CTL Delta UV state. */
+ UINT16 ctl_delta_uv;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_CTL_TEMPERATURE_SET_STRUCT;
+
+/**
+ Light CTL Temperature Status message parameters.
+*/
+typedef struct MS_light_ctl_temperature_status_struct
+{
+ /** The present value of the Light CTL Temperature state. */
+ UINT16 present_ctl_temperature;
+
+ /** The present value of the Light CTL Delta UV state */
+ UINT16 present_ctl_delta_uv;
+
+ /** The target value of the Light CTL Temperature state (Optional) */
+ UINT16 target_ctl_temperature;
+
+ /** The target value of the Light CTL Delta UV state */
+ UINT16 target_ctl_delta_uv;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target CTL Temperature, Delta UV and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_CTL_TEMPERATURE_STATUS_STRUCT;
+
+/**
+ Light CTL Default Set message parameters.
+*/
+typedef struct MS_light_ctl_default_set_struct
+{
+ /** The value of the Light Lightness Default state. */
+ UINT16 lightness;
+
+ /** The value of the Light CTL Temperature Default state. */
+ UINT16 temperature;
+
+ /** The value of the Light CTL Delta UV Default state. */
+ UINT16 delta_uv;
+
+} MS_LIGHT_CTL_DEFAULT_SET_STRUCT;
+
+/**
+ Light CTL Default Status message parameters.
+*/
+typedef struct MS_light_ctl_default_status_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+ /** The value of the Light CTL Temperature Default state */
+ UINT16 temperature;
+
+ /** The value of the Light CTL Delta UV Default state */
+ UINT16 delta_uv;
+
+} MS_LIGHT_CTL_DEFAULT_STATUS_STRUCT;
+
+/**
+ Light CTL Temperature Range Set message parameters.
+*/
+typedef struct MS_light_ctl_temperature_range_set_struct
+{
+ /** The value of the Temperature Range Min field of the Light CTL Temperature Range state */
+ UINT16 range_min;
+
+ /** The value of the Temperature Range Max field of the Light CTL Temperature Range state */
+ UINT16 range_max;
+
+} MS_LIGHT_CTL_TEMPERATURE_RANGE_SET_STRUCT;
+
+/**
+ Light CTL Temperature Range Status message parameters.
+*/
+typedef struct MS_light_ctl_temperature_range_status_struct
+{
+ /** Status Code for the requesting message. */
+ UCHAR status_code;
+
+ /** The value of the Temperature Range Min field of the Light CTL Temperature Range state */
+ UINT16 range_min;
+
+ /** The value of the Temperature Range Max field of the Light CTL Temperature Range state */
+ UINT16 range_max;
+
+} MS_LIGHT_CTL_TEMPERATURE_RANGE_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup light_ctl_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Light Ctl Model APIs.
+*/
+/**
+ \defgroup light_ctl_ser_api_defs Light Ctl Server API Definitions
+ \{
+ This section describes the Light Ctl Server APIs.
+*/
+
+/**
+ \brief API to initialize Light_Ctl Server model
+
+ \par Description
+ This is to initialize Light_Ctl Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] ctl_model_handle
+ Model identifier associated with the Light CTL model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in, out] ctl_setup_model_handle
+ Model identifier associated with the Light CTL Setup model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Ctl Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* ctl_model_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* ctl_setup_model_handle,
+ /* IN */ MS_LIGHT_CTL_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Light_Ctl_Temperature Server model
+
+ \par Description
+ This is to initialize Light_Ctl_Temperature Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Ctl_Temperature Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_temperature_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_CTL_TEMPERATURE_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_temperature_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/** \} */
+
+/**
+ \defgroup light_ctl_cli_api_defs Light Ctl Client API Definitions
+ \{
+ This section describes the Light Ctl Client APIs.
+*/
+
+/**
+ \brief API to initialize Light_Ctl Client model
+
+ \par Description
+ This is to initialize Light_Ctl Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Ctl Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_CTL_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Light_Ctl client model handle
+
+ \par Description
+ This is to get the handle of Light_Ctl client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_ctl_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Light CTL state of an element.
+
+ \par Description
+ Light CTL Get is an acknowledged message used to get the Light CTL state of an element.
+ The response to the Light CTL Get message is a Light CTL Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_get() \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_CTL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Lightness state, Light CTL Temperature state, and the Light CTL Delta UV state of an element.
+
+ \par Description
+ Light CTL Set is an acknowledged message used to set the Light CTL Lightness state, Light CTL Temperature state,
+ and the Light CTL Delta UV state of an element.
+ The response to the Light CTL Set message is a Light CTL Status message.
+
+ \param [in] param Light CTL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_set(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_CTL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Lightness state, Light CTL Temperature state, and the Light CTL Delta UV state of an element.
+
+ \par Description
+ Light CTL Set Unacknowledged is an unacknowledged message used to set the Light CTL Lightness state, Light CTL Temperature state,
+ and the Light CTL Delta UV state of an element
+
+ \param [in] param Light CTL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_set_unacknowledged(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light CTL Temperature state of an element.
+
+ \par Description
+ Light CTL Temperature Get is an acknowledged message used to get the Light CTL Temperature state of an element.
+ The response to the Light CTL Temperature Get message is a Light CTL Temperature Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_get() \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature state and the Light CTL Delta UV state of an element.
+
+ \par Description
+ The Light CTL Temperature Set is an acknowledged message used to set the Light CTL Temperature state
+ and the Light CTL Delta UV state of an element.
+ The response to the Light CTL Temperature Set message is a Light CTL Temperature Status message.
+
+ \param [in] param Light CTL Temperature Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_set(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature state and the Light CTL Delta UV state of an element.
+
+ \par Description
+ The Light CTL Temperature Set Unacknowledged is an unacknowledged message used to set the Light CTL Temperature state
+ and the Light CTL Delta UV state of an element
+
+ \param [in] param Light CTL Temperature Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_set_unacknowledged(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light CTL Temperature Default and Light CTL Delta UV Default states of an element.
+
+ \par Description
+ Light CTL Default Get is an acknowledged message used to get the Light CTL Temperature Default and Light CTL Delta UV Default states of an element.
+ The response to the Light CTL Default Get message is a Light CTL Default Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_default_get() \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_DEFAULT_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_CTL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature Default state and the Light CTL Delta UV Default state of an element.
+
+ \par Description
+ The Light CTL Default Set is an acknowledged message used to set the Light CTL Temperature Default state
+ and the Light CTL Delta UV Default state of an element.
+ The response to the Light CTL Set message is a Light CTL Status message.
+
+ \param [in] param Light CTL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_default_set(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_DEFAULT_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_CTL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature Default state and the Light CTL Delta UV Default state of an element.
+
+ \par Description
+ The Light CTL Default Set Unacknowledged is an unacknowledged message used to set the Light CTL Temperature
+ Default state and the Light CTL Delta UV Default state of an element.
+
+ \param [in] param Light CTL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_default_set_unacknowledged(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_DEFAULT_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light CTL Temperature Range state of an element.
+
+ \par Description
+ The Light CTL Temperature Range Get is an acknowledged message used to get the Light CTL Temperature Range state of an element.
+ The response to the Light CTL Temperature Range Get message is a Light CTL Temperature Range Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_range_get() \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_RANGE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature Range state of an element.
+
+ \par Description
+ Light CTL Temperature Range Set Unacknowledged is an unacknowledged message used to set
+ the Light CTL Temperature Range state of an element.
+
+ \param [in] param Light CTL Temperature Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_range_set(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_RANGE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light CTL Temperature Range state of an element.
+
+ \par Description
+ Light CTL Temperature Range Set is an acknowledged message used to set the Light CTL Temperature Range state of an element.
+ The response to the Light CTL Temperature Range Get message is a Light CTL Temperature Range Status message.
+
+ \param [in] param Light CTL Temperature Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_ctl_temperature_range_set_unacknowledged(param) \
+ MS_light_ctl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_LIGHT_CTL_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_light_hsl_api.h b/src/components/ethermind/mesh/export/include/MS_light_hsl_api.h
new file mode 100644
index 0000000..3eb319e
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_light_hsl_api.h
@@ -0,0 +1,963 @@
+/**
+ \file MS_light_hsl_api.h
+
+ \brief This file defines the Mesh Light Hsl Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LIGHT_HSL_API_
+#define _H_MS_LIGHT_HSL_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup light_hsl_module LIGHT_HSL (Mesh Light Hsl Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup light_hsl_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Light Hsl Server application Asynchronous Notification Callback.
+
+ Light Hsl Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_HSL_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Hsl Hue Server application Asynchronous Notification Callback.
+
+ Light Hsl Hue Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_HSL_HUE_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Hsl Saturation Server application Asynchronous Notification Callback.
+
+ Light Hsl Saturation Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_HSL_SATURATION_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Hsl Client application Asynchronous Notification Callback.
+
+ Light Hsl Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_LIGHT_HSL_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup light_hsl_structures Structures
+ \{
+*/
+
+/**
+ Light HSL Set message parameters.
+*/
+typedef struct MS_light_hsl_set_struct
+{
+ /** The target value of the Light HSL Lightness state */
+ UINT16 hsl_lightness;
+
+ /** The target value of the Light HSL Hue state */
+ UINT16 hsl_hue;
+
+ /** The target value of the Light HSL Saturation state */
+ UINT16 hsl_saturation;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_SET_STRUCT;
+
+/**
+ Light HSL Status message parameters.
+*/
+typedef struct MS_light_hsl_status_struct
+{
+ /** The present value of the Light HSL Lightness state */
+ UINT16 hsl_lightness;
+
+ /** The present value of the Light HSL Hue state */
+ UINT16 hsl_hue;
+
+ /** The present value of the Light HSL Saturation state */
+ UINT16 hsl_saturation;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional field Remaining Time is valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_STATUS_STRUCT;
+
+/**
+ Light HSL Target Status message parameters.
+*/
+typedef struct MS_light_hsl_target_status_struct
+{
+ /** The target value of the Light HSL Lightness state */
+ UINT16 hsl_lightness_target;
+
+ /** The target value of the Light HSL Hue state */
+ UINT16 hsl_hue_target;
+
+ /** The target Light HSL Saturation state */
+ UINT16 hsl_saturation_target;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional field Remaining Time is valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_TARGET_STATUS_STRUCT;
+
+/**
+ Light HSL Default Set message parameters.
+*/
+typedef struct MS_light_hsl_default_set_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+ /** The value of the Light HSL Hue Default state */
+ UINT16 hue;
+
+ /** The value of the Light HSL Saturation Default state */
+ UINT16 saturation;
+
+} MS_LIGHT_HSL_DEFAULT_SET_STRUCT;
+
+/**
+ Light HSL Default Status message parameters.
+*/
+typedef struct MS_light_hsl_default_status_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+ /** The value of the Light HSL Hue Default state */
+ UINT16 hue;
+
+ /** The value of the Light HSL Saturation Default state */
+ UINT16 saturation;
+
+} MS_LIGHT_HSL_DEFAULT_STATUS_STRUCT;
+
+/**
+ Light HSL Range Set message parameters.
+*/
+typedef struct MS_light_hsl_range_set_struct
+{
+ /** The value of the Hue Range Min field of the Light HSL Hue Range state */
+ UINT16 hue_range_min;
+
+ /** The value of the Hue Range Max field of the Light HSL Hue Range state */
+ UINT16 hue_range_max;
+
+ /** The value of the Saturation Range Min field of the Light HSL Saturation Range state */
+ UINT16 saturation_range_min;
+
+ /** The value of the Saturation Range Max field of the Light HSL Saturation Range state */
+ UINT16 saturation_range_max;
+
+} MS_LIGHT_HSL_RANGE_SET_STRUCT;
+
+/**
+ Light HSL Range Status message parameters.
+*/
+typedef struct MS_light_hsl_range_status_struct
+{
+ /** Status Code for the requesting message. */
+ UCHAR status_code;
+
+ /** The value of the Hue Range Min field of the Light HSL Hue Range state */
+ UINT16 hue_range_min;
+
+ /** The value of the Hue Range Max field of the Light HSL Hue Range state */
+ UINT16 hue_range_max;
+
+ /** The value of the Saturation Range Min field of the Light HSL Saturation Range state */
+ UINT16 saturation_range_min;
+
+ /** The value of the Saturation Range Max field of the Light HSL Saturation Range state */
+ UINT16 saturation_range_max;
+
+} MS_LIGHT_HSL_RANGE_STATUS_STRUCT;
+
+/**
+ Light HSL Hue Set message parameters.
+*/
+typedef struct MS_light_hsl_hue_set_struct
+{
+ /** The target value of the Light HSL Hue state. */
+ UINT16 hue;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_HUE_SET_STRUCT;
+
+/**
+ Light HSL Hue Status message parameters.
+*/
+typedef struct MS_light_hsl_hue_status_struct
+{
+ /** The present value of the Light HSL Hue state */
+ UINT16 present_hue;
+
+ /** The target value of the Light HSL Hue state (Optional) */
+ UINT16 target_hue;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Hue and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_HUE_STATUS_STRUCT;
+
+/**
+ Light HSL Saturation Set message parameters.
+*/
+typedef struct MS_light_hsl_saturation_set_struct
+{
+ /** The target value of the Light HSL Saturation state. */
+ UINT16 saturation;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_SATURATION_SET_STRUCT;
+
+/**
+ Light HSL Saturation Status message parameters.
+*/
+typedef struct MS_light_hsl_saturation_status_struct
+{
+ /** The present value of the Light HSL Saturation state. */
+ UINT16 present_saturation;
+
+ /** The target value of the Light HSL Saturation state. (Optional) */
+ UINT16 target_saturation;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Saturation and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_HSL_SATURATION_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup light_hsl_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Light Hsl Model APIs.
+*/
+/**
+ \defgroup light_hsl_ser_api_defs Light Hsl Server API Definitions
+ \{
+ This section describes the Light Hsl Server APIs.
+*/
+
+/**
+ \brief API to initialize Light_Hsl Server model
+
+ \par Description
+ This is to initialize Light_Hsl Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] hsl_model_handle
+ Model identifier associated with the Light HSL model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in, out] hsl_setup_model_handle
+ Model identifier associated with the Light HSL Setup model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Hsl Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* hsl_model_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* hsl_setup_model_handle,
+ /* IN */ MS_LIGHT_HSL_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Light_Hsl_Hue Server model
+
+ \par Description
+ This is to initialize Light_Hsl_Hue Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Hsl_Hue Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_hue_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_HSL_HUE_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Light_Hsl_Saturation Server model
+
+ \par Description
+ This is to initialize Light_Hsl_Saturation Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Hsl_Saturation Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_saturation_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_HSL_SATURATION_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_hue_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_saturation_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup light_hsl_cli_api_defs Light Hsl Client API Definitions
+ \{
+ This section describes the Light Hsl Client APIs.
+*/
+
+/**
+ \brief API to initialize Light_Hsl Client model
+
+ \par Description
+ This is to initialize Light_Hsl Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Hsl Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_HSL_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Light_Hsl client model handle
+
+ \par Description
+ This is to get the handle of Light_Hsl client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_hsl_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Light HSL Lightness, Light HSL Hue, and Light HSL Saturation states of an element.
+
+ \par Description
+ The Light HSL Get is an acknowledged message used to get the Light HSL Lightness, Light HSL Hue, and Light HSL Saturation states of an element.
+ The response to the Light HSL Get message is a Light HSL Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light HSL Lightness state, Light HSL Hue state, and the Light HSL Saturation state of an element.
+
+ \par Description
+ The Light HSL Set Unacknowledged is an unacknowledged message used to set the Light HSL Lightness state, Light HSL Hue state,
+ and the Light HSL Saturation state of an element.
+
+ \param [in] param Light HSL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_set(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_HSL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light HSL Lightness state, Light HSL Hue state, and the Light HSL Saturation state of an element.
+
+ \par Description
+ The Light HSL Set is an acknowledged message used to set the Light HSL Lightness state, Light HSL Hue state,
+ and the Light HSL Saturation state of an element.
+ The response to the Light HSL Set message is a Light HSL Status message.
+
+ \param [in] param Light HSL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_set_unacknowledged(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the target Light HSL Lightness, Light HSL Hue, and Light HSL Saturation states of an element.
+
+ \par Description
+ Light HSL Target Get is an acknowledged message used to get the target Light HSL Lightness, Light HSL Hue,
+ and Light HSL Saturation states of an element.
+ The response to the Light HSL Target Get message is a Light HSL Target Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_target_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_TARGET_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_TARGET_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to to get the Light Lightness Default, the Light HSL Hue Default, and Light HSL Saturation Default states of an element.
+
+ \par Description
+ Light HSL Default Get is an acknowledged message used to get the Light Lightness Default, the Light HSL Hue Default,
+ and Light HSL Saturation Default states of an element.
+ The response to the Light HSL Default Get message is a Light HSL Default Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_default_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_DEFAULT_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default, the Light HSL Hue Default, and Light HSL Saturation Default states of an element.
+
+ \par Description
+ Light HSL Default Set is an acknowledged message used to set the Light Lightness Default, the Light HSL Hue Default,
+ and Light HSL Saturation Default states of an element.
+ The response to the Light HSL Default Set message is a Light HSL Default Status message.
+
+ \param [in] param Light HSL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_default_set(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_DEFAULT_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_HSL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default, the Light HSL Hue Default, and Light HSL Saturation Default states of an element.
+
+ \par Description
+ Light HSL Default Set Unacknowledged is an unacknowledged message used to set the Light Lightness Default, the Light HSL Hue Default,
+ and Light HSL Saturation Default states of an element.
+
+ \param [in] param Light HSL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_default_set_unacknowledged(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_DEFAULT_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+
+ \par Description
+ The Light HSL Range Get is an acknowledged message used to get the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+ The response to the Light HSL Range Get message is a Light HSL Range Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_range_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_RANGE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+
+ \par Description
+ Light HSL Range Set is an acknowledged message used to set the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+ The response to the Light HSL Range Set message is a Light HSL Range Status message.
+
+ \param [in] param Light HSL Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_range_set(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_RANGE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_HSL_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+
+ \par Description
+ Light HSL Range Set Unacknowledged is an unacknowledged message used to set the Light HSL Hue Range and Light HSL Saturation Range states of an element.
+
+ \param [in] param Light HSL Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_range_set_unacknowledged(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_RANGE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light HSL Hue state of an element.
+
+ \par Description
+ The Light HSL Hue Get is an acknowledged message used to get the Light HSL Hue state of an element.
+ The response to the Light HSL Hue Get message is a Light HSL Hue Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_hue_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_HUE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_HUE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the target Light HSL Hue state of an element.
+
+ \par Description
+ The Light HSL Hue Set is an acknowledged message used to set the target Light HSL Hue state of an element.
+ The response to the Light HSL Hue Set message is a Light HSL Hue Status message.
+
+ \param [in] param Light HSL Hue Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_hue_set(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_HUE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_HSL_HUE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the target Light HSL Hue state of an element.
+
+ \par Description
+ The Light HSL Hue Set Unacknowledged is an unacknowledged message used to
+ set the target Light HSL Hue state of an element.
+
+ \param [in] param Light HSL Hue Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_hue_set_unacknowledged(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_HUE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light HSL Saturation state of an element.
+
+ \par Description
+ The Light HSL Saturation Get is an acknowledged message used to get the Light HSL Saturation state of an element.
+ The response to the Light HSL Saturation Get message is a Light HSL Saturation Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_saturation_get() \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_SATURATION_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_HSL_SATURATION_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the target Light HSL Saturation state of an element.
+
+ \par Description
+ The Light HSL Saturation Set is an acknowledged message used to set the target Light HSL Saturation state of an element.
+ The response to the Light HSL Saturation Set message is a Light HSL Saturation Status message.
+
+ \param [in] param Light HSL Saturation Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_saturation_set(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_SATURATION_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_HSL_SATURATION_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the target Light HSL Saturation state of an element.
+
+ \par Description
+ The Light HSL Saturation Set Unacknowledged is an unacknowledged message
+ used to set the target Light HSL Saturation state of an element.
+
+ \param [in] param Light HSL Saturation Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_hsl_saturation_set_unacknowledged(param) \
+ MS_light_hsl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_HSL_SATURATION_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_LIGHT_HSL_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_light_lc_api.h b/src/components/ethermind/mesh/export/include/MS_light_lc_api.h
new file mode 100644
index 0000000..ee002f5
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_light_lc_api.h
@@ -0,0 +1,570 @@
+/**
+ \file MS_light_lc_api.h
+
+ \brief This file defines the Mesh Light Lc Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LIGHT_LC_API_
+#define _H_MS_LIGHT_LC_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup light_lc_module LIGHT_LC (Mesh Light Lc Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup light_lc_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Light Lc Server application Asynchronous Notification Callback.
+
+ Light Lc Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_LC_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Lc Client application Asynchronous Notification Callback.
+
+ Light Lc Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_LIGHT_LC_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup light_lc_structures Structures
+ \{
+*/
+
+/**
+ Light LC Mode Set/Status message parameters.
+*/
+typedef struct MS_light_lc_mode_struct
+{
+ /** The target value of the Light LC Mode state */
+ UCHAR mode;
+
+} MS_LIGHT_LC_MODE_STRUCT;
+
+typedef struct MS_light_lc_om_struct
+{
+ /** The target value of the Light LC Occupancy Mode state */
+ UCHAR mode;
+
+} MS_LIGHT_LC_OM_STRUCT;
+
+/**
+ Light LC Light OnOff Set message parameters.
+*/
+typedef struct MS_light_lc_light_onoff_set_struct
+{
+ /** The target value of the Light LC Light OnOff state */
+ UCHAR light_onoff;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LC_LIGHT_ONOFF_SET_STRUCT;
+
+/**
+ Light LC Light OnOff Status message parameters.
+*/
+typedef struct MS_light_lc_light_onoff_status_struct
+{
+ /** The present value of the Light LC Light OnOff state */
+ UCHAR present_light_onoff;
+
+ /** The target value of the Light LC Light OnOff state (Optional) */
+ UCHAR target_light_onoff;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target LC Light OnOff and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LC_LIGHT_ONOFF_STATUS_STRUCT;
+
+/**
+ Light LC Property Get message parameters.
+*/
+typedef struct MS_light_lc_property_get_struct
+{
+ /** Property ID identifying a Light LC Property. */
+ UINT16 light_lc_property_id;
+
+} MS_LIGHT_LC_PROPERTY_GET_STRUCT;
+
+/**
+ Light LC Property Set message parameters.
+*/
+typedef struct MS_light_lc_property_set_struct
+{
+ /** Property ID identifying a Light LC Property. */
+ UINT16 light_lc_property_id;
+
+ /** Raw value for the Light LC Property */
+ UCHAR* light_lc_property_value;
+
+ /** Raw value length for the Light LC Property */
+ UINT16 light_lc_property_value_len;
+
+} MS_LIGHT_LC_PROPERTY_SET_STRUCT;
+
+/**
+ Light LC Property Status message parameters.
+*/
+typedef struct MS_light_lc_property_status_struct
+{
+ /** Property ID identifying a Light LC Property. */
+ UINT16 light_lc_property_id;
+
+ /** Raw value for the Light LC Property */
+ UCHAR* light_lc_property_value;
+
+ /** Raw value length for the Light LC Property */
+ UINT16 light_lc_property_value_len;
+
+} MS_LIGHT_LC_PROPERTY_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup light_lc_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Light Lc Model APIs.
+*/
+/**
+ \defgroup light_lc_ser_api_defs Light Lc Server API Definitions
+ \{
+ This section describes the Light Lc Server APIs.
+*/
+
+/**
+ \brief API to initialize Light_Lc Server model
+
+ \par Description
+ This is to initialize Light_Lc Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] lc_model_handle
+ Model identifier associated with the Light LC model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in, out] lc_setup_model_handle
+ Model identifier associated with the Light LC Setup model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Lc Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lc_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* lc_model_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* lc_setup_model_handle,
+ /* IN */ MS_LIGHT_LC_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lc_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup light_lc_cli_api_defs Light Lc Client API Definitions
+ \{
+ This section describes the Light Lc Client APIs.
+*/
+
+/**
+ \brief API to initialize Light_Lc Client model
+
+ \par Description
+ This is to initialize Light_Lc Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Lc Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lc_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_LC_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Light_Lc client model handle
+
+ \par Description
+ This is to get the handle of Light_Lc client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lc_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lc_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Light LC Mode state of an element.
+
+ \par Description
+ Light LC Mode Get is an acknowledged message used to get the Light LC Mode state of an element.
+ The response to the Light LC Mode Get message is a Light LC Mode Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_mode_get() \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_MODE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LC_MODE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Mode state of an element.
+
+ \par Description
+ The Light LC Mode Set is an acknowledged message used to set the Light LC Mode state of an element.
+ The response to the Light LC Mode Set message is a Light LC Mode Status message.
+
+ \param [in] param Light LC Mode Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_mode_set(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_MODE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LC_MODE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Mode state of an element.
+
+ \par Description
+ The Light LC Mode Set Unacknowledged is an unacknowledged message used to
+ set the Light LC Mode state of an element.
+
+ \param [in] param Light LC Mode Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_mode_set_unacknowledged(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_MODE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light LC Occupancy Mode state of an element.
+
+ \par Description
+ Light LC OM Get is an acknowledged message used to get the Light LC Occupancy Mode state of an element.
+ The response to the Light LC OM Get message is a Light LC OM Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_om_get() \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_OM_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LC_OM_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Occupancy Mode state of an element.
+
+ \par Description
+ The Light LC OM Set is an acknowledged message used to set the Light LC Occupancy Mode state of an element.
+ The response to the Light LC OM Set message is a Light LC OM Status message.
+
+ \param [in] param Light LC OM Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_om_set(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_OM_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LC_OM_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Occupancy Mode state of an element.
+
+ \par Description
+ The Light LC OM Set Unacknowledged is an unacknowledged message used to set
+ the Light LC Occupancy Mode state of an element.
+
+ \param [in] param Light LC OM Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_om_set_unacknowledged(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_OM_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light LC Light OnOff state of an element.
+
+ \par Description
+ Light LC Light OnOff Get is an acknowledged message used to get the Light LC Light OnOff state of an element.
+ The response to the Light LC Light OnOff Get message is a Light LC Light OnOff Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_light_onoff_get() \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_LIGHT_ONOFF_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LC_LIGHT_ONOFF_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Light OnOff state of an element.
+
+ \par Description
+ The Light LC Light OnOff Set is an acknowledged message used to set the Light LC Light OnOff state of an element.
+ The response to the Light LC Light OnOff Set message is a Light LC Light OnOff Status message.
+
+ \param [in] param Light LC Light OnOff Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_light_onoff_set(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_LIGHT_ONOFF_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LC_LIGHT_ONOFF_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Light OnOff state of an element.
+
+ \par Description
+ The Light LC Light OnOff Set Unacknowledged is an unacknowledged message
+ used to set the Light LC Light OnOff state of an element.
+
+ \param [in] param Light LC Light OnOff Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_light_onoff_set_unacknowledged(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_LIGHT_ONOFF_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to to get the Light LC Property state of an element.
+
+ \par Description
+ Light LC Property Get is an acknowledged message used to get the Light LC Property state of an element.
+ The response to the Light LC Property Get message is a Light LC Property Status message.
+
+ \param [in] param Light LC Property Get message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_property_get(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_PROPERTY_GET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LC_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Property state of an element.
+
+ \par Description
+ The Light LC Property Set is an acknowledged message used to set the Light LC Property state of an element.
+ The response to the Light LC Property Set message is a Light LC Property Status message.
+
+ \param [in] param Light LC Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_property_set(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_PROPERTY_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LC_PROPERTY_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light LC Property state of an element.
+
+ \par Description
+ The Light LC Property Set Unacknowledged is an unacknowledged message used
+ to set the Light LC Property state of an element.
+
+ \param [in] param Light LC Property Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lc_property_set_unacknowledged(param) \
+ MS_light_lc_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LC_PROPERTY_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_LIGHT_LC_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_light_lightness_api.h b/src/components/ethermind/mesh/export/include/MS_light_lightness_api.h
new file mode 100644
index 0000000..df4d6f0
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_light_lightness_api.h
@@ -0,0 +1,718 @@
+/**
+ \file MS_light_lightness_api.h
+
+ \brief This file defines the Mesh Light Lightness Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LIGHT_LIGHTNESS_API_
+#define _H_MS_LIGHT_LIGHTNESS_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup light_lightness_module LIGHT_LIGHTNESS (Mesh Light Lightness Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup light_lightness_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Light Lightness Server application Asynchronous Notification Callback.
+
+ Light Lightness Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_LIGHTNESS_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Lightness Setup Server application Asynchronous Notification Callback.
+
+ Light Lightness Setup Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_LIGHTNESS_SETUP_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Lightness Client application Asynchronous Notification Callback.
+
+ Light Lightness Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_LIGHT_LIGHTNESS_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup light_lightness_structures Structures
+ \{
+*/
+
+/**
+ Light Lightness Set message parameters.
+*/
+typedef struct MS_light_lightness_set_struct
+{
+ /** The target value of the Light Lightness Actual state. */
+ UINT16 lightness;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LIGHTNESS_SET_STRUCT;
+
+/**
+ Light Lightness Status message parameters.
+*/
+typedef struct MS_light_lightness_status_struct
+{
+ /** The present value of the Light Lightness Actual state. */
+ UINT16 present_lightness;
+
+ /** The target value of the Light Lightness Actual state. (Optional) */
+ UINT16 target_lightness;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Light Lightness Actual and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LIGHTNESS_STATUS_STRUCT;
+
+/**
+ Light Lightness Linear Set message parameters.
+*/
+typedef struct MS_light_lightness_linear_set_struct
+{
+ /** The target value of the Light Lightness Linear state. */
+ UINT16 lightness;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LIGHTNESS_LINEAR_SET_STRUCT;
+
+/**
+ Light Lightness Linear Status message parameters.
+*/
+typedef struct MS_light_lightness_linear_status_struct
+{
+ /** The present value of the Light Lightness Linear state */
+ UINT16 present_lightness;
+
+ /** The target value of the Light Lightness Linear state (Optional) */
+ UINT16 target_lightness;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Light Lightness Linear and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_LIGHTNESS_LINEAR_STATUS_STRUCT;
+
+/**
+ Light Lightness Last Status message parameters.
+*/
+typedef struct MS_light_lightness_last_status_struct
+{
+ /** The value of the Light Lightness Last */
+ UINT16 lightness;
+
+} MS_LIGHT_LIGHTNESS_LAST_STATUS_STRUCT;
+
+/**
+ Light Lightness Default Set message parameters.
+*/
+typedef struct MS_light_lightness_default_set_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+} MS_LIGHT_LIGHTNESS_DEFAULT_SET_STRUCT;
+
+/**
+ Light Lightness Range Set message parameters.
+*/
+typedef struct MS_light_lightness_range_set_struct
+{
+ /** The value of the Lightness Range Min field of the Light Lightness Range state */
+ UINT16 range_min;
+
+ /** The value of the Lightness Range Max field of the Light Lightness Range state */
+ UINT16 range_max;
+
+} MS_LIGHT_LIGHTNESS_RANGE_SET_STRUCT;
+
+/**
+ Light Lightness Range Status message parameters.
+*/
+typedef struct MS_light_lightness_range_status_struct
+{
+ /** Status Code for the requesting message. */
+ UCHAR status_code;
+
+ /** The value of the Lightness Range Min field of the Light Lightness Range state */
+ UINT16 range_min;
+
+ /** The value of the Lightness Range Max field of the Light Lightness Range state */
+ UINT16 range_max;
+
+} MS_LIGHT_LIGHTNESS_RANGE_STATUS_STRUCT;
+
+/**
+ Light Lightness Default Status message parameters.
+*/
+typedef struct MS_light_lightness_default_status_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+} MS_LIGHT_LIGHTNESS_DEFAULT_STATUS_STRUCT;
+
+typedef struct MS_light_lightness_last_or_default_status_struct
+{
+ UINT16 lightness;
+
+} MS_LIGHT_LIGHTNESS_LAST_OR_DEFAULT_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup light_lightness_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Light Lightness Model APIs.
+*/
+/**
+ \defgroup light_lightness_ser_api_defs Light Lightness Server API Definitions
+ \{
+ This section describes the Light Lightness Server APIs.
+*/
+
+/**
+ \brief API to initialize Light_Lightness Server model
+
+ \par Description
+ This is to initialize Light_Lightness Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Lightness Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_LIGHTNESS_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to initialize Light_Lightness_Setup Server model
+
+ \par Description
+ This is to initialize Light_Lightness_Setup Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Lightness_Setup Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_setup_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_LIGHTNESS_SETUP_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_setup_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup light_lightness_cli_api_defs Light Lightness Client API Definitions
+ \{
+ This section describes the Light Lightness Client APIs.
+*/
+
+/**
+ \brief API to initialize Light_Lightness Client model
+
+ \par Description
+ This is to initialize Light_Lightness Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Lightness Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_LIGHTNESS_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Light_Lightness client model handle
+
+ \par Description
+ This is to get the handle of Light_Lightness client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_lightness_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Light Lightness Actual state of an element.
+
+ \par Description
+ Light Lightness Get is an acknowledged message used to get the Light Lightness Actual state of an element.
+ The response to the Light Lightness Get message is a Light Lightness Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_get() \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LIGHTNESS_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Actual state of an element.
+
+ \par Description
+ The Light Lightness Set is an acknowledged message used to set the Light Lightness Actual state of an element.
+ The response to the Light Lightness Set message is a Light Lightness Status message.
+
+ \param [in] param Light Lightness Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_set(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LIGHTNESS_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Actual state of an element.
+
+ \par Description
+ The Light Lightness Set Unacknowledged is an unacknowledged message used to
+ set the Light Lightness Actual state of an element.
+
+ \param [in] param Light Lightness Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_set_unacknowledged(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light Lightness Linear state of an element.
+
+ \par Description
+ Light Lightness Linear Get is an acknowledged message used to get the Light Lightness Linear state of an element.
+ The response to the Light Lightness Linear Get message is a Light Lightness Linear Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_linear_get() \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_LINEAR_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LIGHTNESS_LINEAR_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Linear state of an element.
+
+ \par Description
+ The Light Lightness Linear Set is an acknowledged message used to set the Light Lightness Linear state of an element.
+ The response to the Light Lightness Linear Set message is a Light Lightness Linear Status message.
+
+ \param [in] param Light Lightness Linear Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_linear_set(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_LINEAR_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LIGHTNESS_LINEAR_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Linear state of an element.
+
+ \par Description
+ The Light Lightness Linear Set Unacknowledged is an unacknowledged message
+ used to set the Light Lightness Linear state of an element.
+
+ \param [in] param Light Lightness Linear Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_linear_set_unacknowledged(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_LINEAR_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light Lightness Last state of an element.
+
+ \par Description
+ Light Lightness Last Get is an acknowledged message used to get the Light Lightness Last state of an element.
+ The response to the Light Lightness Last Get message is a Light Lightness Last Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_last_get() \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_LAST_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LIGHTNESS_LAST_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Light Lightness Default state of an element.
+
+ \par Description
+ Light Lightness Default Get is an acknowledged message used to get the Light Lightness Default state of an element.
+ The response to the Light Lightness Default Get message is a Light Lightness Default Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_default_get() \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_DEFAULT_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LIGHTNESS_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default state of an element.
+
+ \par Description
+ The Light Lightness Default Set is an acknowledged message used to set the Light Lightness Default state of an element.
+ The response to the Light Lightness Default Set message is a Light Lightness Default Status message.
+
+ \param [in] param Light Lightness Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_default_set(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_DEFAULT_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LIGHTNESS_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default state of an element.
+
+ \par Description
+ The Light Lightness Default Set Unacknowledged is an unacknowledged message
+ used to set the Light Lightness Default state of an element.
+
+ \param [in] param Light Lightness Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_default_set_unacknowledged(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_DEFAULT_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light Lightness Range state of an element.
+
+ \par Description
+ The Light Lightness Range Get is an acknowledged message used to get the Light Lightness Range state of an element.
+ The response to the Light Lightness Range Get message is a Light Lightness Range Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_range_get() \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_RANGE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_LIGHTNESS_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to acknowledged message used to set the Light Lightness Range state of an element.
+
+ \par Description
+ Light Lightness Range Set is an acknowledged message used to set the Light Lightness Range state of an element.
+ The response to the Light Lightness Range Get message is a Light Lightness Range Status message.
+
+ \param [in] param Light Lightness Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_range_set(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_RANGE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_LIGHTNESS_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to acknowledged message used to set the Light Lightness Range state of an element.
+
+ \par Description
+ Light Lightness Range Set Unacknowledged is an unacknowledged message used
+ to set the Light Lightness Range state of an element.
+
+ \param [in] param Light Lightness Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_lightness_range_set_unacknowledged(param) \
+ MS_light_lightness_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_LIGHTNESS_RANGE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_LIGHT_LIGHTNESS_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_light_xyl_api.h b/src/components/ethermind/mesh/export/include/MS_light_xyl_api.h
new file mode 100644
index 0000000..8465baf
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_light_xyl_api.h
@@ -0,0 +1,590 @@
+/**
+ \file MS_light_xyl_api.h
+
+ \brief This file defines the Mesh Light Xyl Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LIGHT_XYL_API_
+#define _H_MS_LIGHT_XYL_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup light_xyl_module LIGHT_XYL (Mesh Light Xyl Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Generic OnOff Model (ONOFF) module to the Application.
+*/
+
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup light_xyl_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Light Xyl Server application Asynchronous Notification Callback.
+
+ Light Xyl Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+typedef API_RESULT (* MS_LIGHT_XYL_SERVER_CB)
+(
+ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+
+) DECL_REENTRANT;
+
+/**
+ Light Xyl Client application Asynchronous Notification Callback.
+
+ Light Xyl Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_LIGHT_XYL_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup light_xyl_structures Structures
+ \{
+*/
+
+/**
+ Light xyL Set message parameters.
+*/
+typedef struct MS_light_xyl_set_struct
+{
+ /** The target value of the Light xyL Lightness state */
+ UINT16 xyl_lightness;
+
+ /** The target value of the Light xyL x state */
+ UINT16 xyl_x;
+
+ /** The target value of the Light xyL y state */
+ UINT16 xyl_y;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_XYL_SET_STRUCT;
+
+/**
+ Light xyL Status Unacknowledged message parameters.
+*/
+typedef struct MS_light_xyl_status_struct
+{
+ /** The present value of the Light xyL Lightness state */
+ UINT16 xyl_lightness;
+
+ /** The present value of the Light xyL x state */
+ UINT16 xyl_x;
+
+ /** The present value of the Light xyL y state */
+ UINT16 xyl_y;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional field Remaining Time is valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_XYL_STATUS_STRUCT;
+
+/**
+ Light xyL Target Status Unacknowledged message parameters.
+*/
+typedef struct MS_light_xyl_target_status_struct
+{
+ /** The target value of the Light xyL Lightness state */
+ UINT16 target_xyl_lightness;
+
+ /** The target value of the Light xyL x state */
+ UINT16 target_xyl_x;
+
+ /** The target value of the Light xyL y state */
+ UINT16 target_xyl_y;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional field Remaining Time is valid */
+ UCHAR optional_fields_present;
+
+} MS_LIGHT_XYL_TARGET_STATUS_STRUCT;
+
+/**
+ Light HSL Default Set message parameters.
+*/
+typedef struct MS_light_xyl_default_set_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+ /** The value of the Light xyL x Default state */
+ UINT16 xyl_x;
+
+ /** The value of the Light xyL y Default state */
+ UINT16 xyl_y;
+
+} MS_LIGHT_XYL_DEFAULT_SET_STRUCT;
+
+/**
+ Light xyL Default Status message parameters.
+*/
+typedef struct MS_light_xyl_default_status_struct
+{
+ /** The value of the Light Lightness Default state */
+ UINT16 lightness;
+
+ /** The value of the Light xyL x Default state */
+ UINT16 xyl_x;
+
+ /** The value of the Light xyL y Default state */
+ UINT16 xyl_y;
+
+} MS_LIGHT_XYL_DEFAULT_STATUS_STRUCT;
+
+/**
+ Light xyL Range Set message parameters.
+*/
+typedef struct MS_light_xyl_range_set_struct
+{
+ /** The value of the xyL x Range Min field of the Light xyL x Range state */
+ UINT16 xyl_x_range_min;
+
+ /** The value of the xyL x Range Max field of the Light xyL x Range state */
+ UINT16 xyl_x_range_max;
+
+ /** The value of the xyL y Range Min field of the Light xyL y Range state */
+ UINT16 xyl_y_range_min;
+
+ /** The value of the xyL y Range Max field of the Light xyL y Range state */
+ UINT16 xyl_y_range_max;
+
+} MS_LIGHT_XYL_RANGE_SET_STRUCT;
+
+/**
+ Light xyL Range Status message parameters.
+*/
+typedef struct MS_light_xyl_range_status_struct
+{
+ /** Status Code for the requesting message. */
+ UCHAR status_code;
+
+ /** The value of the xyL x Range Min field of the Light xyL x Range state */
+ UINT16 xyl_x_range_min;
+
+ /** The value of the xyL x Range Max field of the Light xyL x Range state */
+ UINT16 xyl_x_range_max;
+
+ /** The value of the xyL y Range Min field of the Light xyL y Range state */
+ UINT16 xyl_y_range_min;
+
+ /** The value of the xyL y Range Max field of the Light xyL y Range state */
+ UINT16 xyl_y_range_max;
+
+} MS_LIGHT_XYL_RANGE_STATUS_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup light_xyl_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Light Xyl Model APIs.
+*/
+/**
+ \defgroup light_xyl_ser_api_defs Light Xyl Server API Definitions
+ \{
+ This section describes the Light Xyl Server APIs.
+*/
+
+/**
+ \brief API to initialize Light_Xyl Server model
+
+ \par Description
+ This is to initialize Light_Xyl Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] xyl_model_handle
+ Model identifier associated with the Light xyl model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in, out] xyl_setup_model_handle
+ Model identifier associated with the Light xyl Setup model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Xyl Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_xyl_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* xyl_model_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* xyl_setup_model_handle,
+ /* IN */ MS_LIGHT_XYL_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_xyl_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup light_xyl_cli_api_defs Light Xyl Client API Definitions
+ \{
+ This section describes the Light Xyl Client APIs.
+*/
+
+/**
+ \brief API to initialize Light_Xyl Client model
+
+ \par Description
+ This is to initialize Light_Xyl Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Light_Xyl Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_xyl_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_LIGHT_XYL_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Light_Xyl client model handle
+
+ \par Description
+ This is to get the handle of Light_Xyl client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_xyl_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_light_xyl_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the Light xyL Lightness, Light xyL x, and Light xyL y states of an element.
+
+ \par Description
+ The Light xyL Get is an acknowledged message used to get the Light xyL
+ Lightness, Light xyL x, and Light xyL y states of an element.
+ Upon receiving a Light xyL Get message, the element shall respond with a Light xyL Status message.
+ The response to the Light xyL Get message is a Light xyL Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_get() \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_XYL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light xyL Lightness, Light xyL x state, and the Light xyL y states of an element.
+
+ \par Description
+ The Light xyL Set is an acknowledged message used to set the Light xyL Lightness, Light xyL x state, and the Light xyL y states of an element.
+ The response to the Light xyL Set message is a Light xyL Status message.
+
+ \param [in] param Light xyL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_set(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_XYL_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light xyL Lightness, Light xyL x state, and the Light xyL y states of an element.
+
+ \par Description
+ The Light xyL Set Unacknowledged is an unacknowledged message used to set
+ the Light xyL Lightness, Light xyL x, and the Light xyL y states of an
+ element.
+
+ \param [in] param Light xyL Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_set_unacknowledged(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the target Light xyL Lightness, Light xyL x, and Light xyL y states of an element.
+
+ \par Description
+ The Light xyL Target Get is an acknowledged message used to get the target Light xyL Lightness, Light xyL x, and Light xyL y states of an element.
+ The response to the Light xyL Target Get message is a Light xyL Target Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_target_get() \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_TARGET_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_XYL_TARGET_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to get the Light Lightness Default, the Light xyL x Default, and Light xyL y Default states of an element.
+
+ \par Description
+ Light xyL Default Get is an acknowledged message used to get the Light Lightness Default, the Light xyL x Default, and Light xyL y Default states of an element.
+ The response to the Light xyL Default Get message is a Light xyL Default Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_default_get() \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_DEFAULT_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_XYL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default, the Light xyL x Default, and Light xyL y Default states of an element.
+
+ \par Description
+ Light xyL Default Set is an acknowledged message used to set the Light Lightness Default, the Light xyL x Default, and Light xyL y Default states of an element.
+ The response to the Light xyL Default Set message is a Light xyL Default Status message.
+
+ \param [in] param Light HSL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_default_set(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_DEFAULT_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_XYL_DEFAULT_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light Lightness Default, the Light xyL x Default, and Light xyL y Default states of an element.
+
+ \par Description
+ Light xyL Default Set Unacknowledged is an unacknowledged message used to
+ set the Light Lightness Default, the Light xyL x Default, and Light xyL y
+ Default states of an element.
+
+ \param [in] param Light HSL Default Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_default_set_unacknowledged(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_DEFAULT_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the Light xyL x Range and Light xyL y Range states of an element.
+
+ \par Description
+ The Light xyL Range Get is an acknowledged message used to get the Light xyL x Range and Light xyL y Range states of an element.
+ The response to the Light xyL Range Get message is a Light xyL Range Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_range_get() \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_RANGE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_LIGHT_XYL_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light xyL x Range and Light xyL y Range states of an element.
+
+ \par Description
+ Light xyL Range Set is an acknowledged message used to set the Light xyL x Range and Light xyL y Range states of an element.
+ The response to the Light xyL Range Set message is a Light xyL Range Status message.
+
+ \param [in] param Light xyL Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_range_set(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_RANGE_SET_OPCODE,\
+ param,\
+ MS_ACCESS_LIGHT_XYL_RANGE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to set the Light xyL x Range and Light xyL y Range states of an element.
+
+ \par Description
+ Light xyL Range Set Unacknowledged is an unacknowledged message used to set
+ the Light xyL x Range and Light xyL y Range states of an element.
+
+ \param [in] param Light xyL Range Set message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_light_xyl_range_set_unacknowledged(param) \
+ MS_light_xyl_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_LIGHT_XYL_RANGE_SET_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_LIGHT_XYL_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_ltrn_api.h b/src/components/ethermind/mesh/export/include/MS_ltrn_api.h
new file mode 100644
index 0000000..78d8392
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_ltrn_api.h
@@ -0,0 +1,250 @@
+
+/**
+ \file MS_ltrn_api.h
+
+ \brief This file defines the Mesh Lower Transport Application Interface - includes
+ Data Structures and Methods.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_LTRN_API_
+#define _H_MS_LTRN_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+/* Network API Header File */
+#include "MS_net_api.h"
+
+/* --------------------------------------------- Global Definitions */
+
+/**
+ \defgroup ltrn_module LTRANSPORT (Mesh Lower Transport Layer)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Lower Transport (LTRANSPORT) module to the Application and other upper
+ layers of the stack.
+*/
+
+/**
+ \defgroup ltrn_defines Defines
+ \{
+ Describes defines for the module.
+*/
+
+/**
+ \defgroup ltrn_constants Constants
+ \{
+ Describes Constants defined by the module.
+*/
+
+/** Unsgemented Access Message */
+#define MS_UNSEGMENTED_ACCESS_MSG 0x00
+
+/** Segmented Access Message */
+#define MS_SEGMENTED_ACCESS_MSG 0x01
+
+/** Unsegmented Control Message */
+#define MS_UNSEGMENTED_CTRL_MSG 0x02
+
+/** Segmented Control Message */
+#define MS_SEGMENTED_CTRL_MSG 0x03
+
+/** Transport Message Type */
+typedef UCHAR MS_TRN_MSG_TYPE;
+
+/** Transport Layer Control Packet */
+#define MS_TRN_CTRL_PKT 0x01
+
+/** Access Layer Packet */
+#define MS_TRN_ACCESS_PKT 0x00
+
+/** \} */
+
+/**
+ \defgroup ltrn_events Events
+ \{
+ This section lists the Asynchronous Events notified to Application by the
+ Module.
+*/
+/** \} */
+/** \} */
+
+/**
+ \defgroup ltrn_marcos Utility Macros
+ \{
+ Initialization and other Utility Macros offered by the module.
+*/
+
+/** \} */
+
+/* --------------------------------------------- Data Types/ Structures */
+
+/**
+ \addtogroup ltrn_defines Defines
+ \{
+*/
+
+/**
+ \addtogroup ltrn_structures Structures
+ \{
+*/
+/** LPN Handle */
+typedef UINT8 LPN_HANDLE;
+
+
+/** \} */
+
+/** \} */
+
+/**
+ \defgroup ltrn_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+/**
+ Lower TRANSPORT Application Asynchronous Notification Callback.
+
+ Lower TRANSPORT calls the registered callback to indicate events occurred to the
+ application.
+
+ \param net_hdr Network Header.
+ \param subnet_handle Associated Subnet Handle.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (*LTRN_NTF_CB)
+(
+ MS_NET_HEADER* net_hdr,
+ MS_SUBNET_HANDLE subnet_handle,
+ UCHAR szmic,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \addtogroup ltrn_defines Defines
+ \{
+*/
+
+/**
+ \addtogroup ltrn_structures Structures
+ \{
+*/
+
+/** \} */
+
+/** \} */
+
+/** TCF (Transport Control Field) - Transport Field Value */
+
+
+/* --------------------------------------------- Function */
+
+/**
+ \defgroup ltrn_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Lower Transport Layer APIs.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ \brief Register Inerface with Lower Transport Layer
+
+ \par Description
+ This routine registers interface with the Lower Transport Layer.
+ Transport Layer supports single Application, hence this rouine shall be called once.
+
+ \param [in] ltrn_cb
+ Upper Layer Notification Callback
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_ltrn_register
+(
+ /* IN */ LTRN_NTF_CB ltrn_cb
+);
+
+/**
+ \brief API to send transport PDUs
+
+ \par Description
+ This routine sends transport PDUs to peer device.
+
+ \param [in] src_addr
+ Source Address
+
+ \param [in] dst_addr
+ Destination Address
+
+ \param [in] subnet_handle
+ Handle identifying the Subnet
+
+ \param [in] msg_type
+ Transport Message Type
+
+ \param [in] ttl
+ Time to Live
+
+ \param [in] akf
+ Application Key Flag
+
+ \param [in] aid
+ Application Key Identifier
+
+ \param [in] seq_num
+ Sequence Number to be used for the Packet
+
+ \param [in] buffer
+ Transport Packet
+
+ \param [in] buffer_len
+ Transport Packet Length
+
+ \param [in] reliable
+ If requires lower transport Ack, set reliable as TRUE
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_ltrn_send_pdu
+(
+ /* IN */ MS_NET_ADDR src_addr,
+ /* IN */ MS_NET_ADDR dst_addr,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ MS_TRN_MSG_TYPE msg_type,
+ /* IN */ UINT8 ttl,
+ /* IN */ UINT8 akf,
+ /* IN */ UINT8 aid,
+ /* IN */ UINT32 seq_num,
+ /* IN */ UCHAR* buffer,
+ /* IN */ UINT16 buffer_len,
+ /* IN */ UINT8 reliable
+);
+
+/**
+ \brief To clear all Segmentation and Reassembly Contexts
+
+ \par Description
+ This routine clears all Segmentation and Reassembly Contexts.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_ltrn_clear_sar_contexts(void);
+
+#ifdef __cplusplus
+};
+#endif
+
+/** \} */
+
+/** \} */
+
+#endif /* _H_MS_LTRN_API_ */
+
diff --git a/src/components/ethermind/mesh/export/include/MS_model_states.h b/src/components/ethermind/mesh/export/include/MS_model_states.h
new file mode 100644
index 0000000..64d849e
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_model_states.h
@@ -0,0 +1,1396 @@
+/**
+ \file MS_model_states.h
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_MODEL_STATES_
+#define _H_MS_MODEL_STATES_
+
+
+/* --------------------------------------------- Global Definitions */
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/** Model State Type Defines */
+#define MS_STATE_GENERIC_ONOFF_T 0
+#define MS_STATE_GENERIC_LEVEL_T 1
+#define MS_STATE_GENERIC_DEFAULT_TRANSITION_TIME_T 2
+#define MS_STATE_GENERIC_ONPOWERUP_T 3
+#define MS_STATE_GENERIC_POWER_ACTUAL_T 4
+#define MS_STATE_GENERIC_POWER_LAST_T 5
+#define MS_STATE_GENERIC_POWER_DEFAULT_T 6
+#define MS_STATE_GENERIC_POWER_RANGE_T 7
+#define MS_STATE_GENERIC_POWER_LEVEL_T 8
+#define MS_STATE_GENERIC_BATTERY_T 9
+#define MS_STATE_GENERIC_LOCATION_GLOBAL_T 10
+#define MS_STATE_GENERIC_LOCATION_LOCAL_T 11
+#define MS_STATE_GENERIC_LOCATION_T 12
+#define MS_STATE_GENERIC_USER_PROPERTY_T 13
+#define MS_STATE_GENERIC_ADMIN_PROPERTY_T 14
+#define MS_STATE_GENERIC_MANUFACTURER_PROPERTY_T 15
+#define MS_STATE_GENERIC_PROPERTY_ID_T 16
+#define MS_STATE_GENERIC_PROPERTY_IDS_T 17
+#define MS_STATE_SENSOR_PROPERTY_ID_T 18
+#define MS_STATE_SENSOR_DESCRIPTOR_T 19
+#define MS_STATE_SENSOR_SETTINGS_T 20
+#define MS_STATE_SENSOR_SETTING_T 21
+#define MS_STATE_SENSOR_CADENCE_T 22
+#define MS_STATE_SENSOR_DATA_PROPERTY_ID_T 23
+#define MS_STATE_SENSOR_DATA_T 24
+#define MS_STATE_SENSOR_COLUMN_STATUS_T 25
+#define MS_STATE_SENSOR_SERIES_COLUMN_T 26
+
+#define MS_STATE_TIME_T 27
+#define MS_STATE_TIME_ZONE_T 28
+#define MS_STATE_TIME_TAI_UTC_DELTA_T 29
+#define MS_STATE_TIME_ROLE_T 30
+#define MS_STATE_SCENE_NUMBER_T 31
+#define MS_STATE_SCENE_STATUS_T 32
+#define MS_STATE_SCENE_REGISTER_STATUS_T 33
+#define MS_STATE_SCHEDULER_SCHEDULES_T 34
+#define MS_STATE_SCHEDULER_ENTRY_INDEX_T 35
+#define MS_STATE_SCHEDULER_ENTRY_T 36
+#define MS_STATE_LIGHT_LIGHTNESS_LINEAR_T 37
+#define MS_STATE_LIGHT_LIGHTNESS_ACTUAL_T 38
+#define MS_STATE_LIGHT_LIGHTNESS_LAST_T 39
+#define MS_STATE_LIGHT_LIGHTNESS_DEFAULT_T 40
+#define MS_STATE_LIGHT_LIGHTNESS_RANGE_T 41
+#define MS_STATE_LIGHT_LIGHTNESS_T 42
+#define MS_STATE_LIGHT_CTL_T 43
+#define MS_STATE_LIGHT_CTL_DEFAULT_T 44
+#define MS_STATE_LIGHT_CTL_TEMPERATURE_T 45
+#define MS_STATE_LIGHT_CTL_TEMPERATURE_RANGE_T 46
+#define MS_STATE_LIGHT_HSL_T 47
+#define MS_STATE_LIGHT_HSL_TARGET_T 48
+#define MS_STATE_LIGHT_HSL_DEFAULT_T 49
+#define MS_STATE_LIGHT_HSL_HUE_T 50
+#define MS_STATE_LIGHT_HSL_SATURATION_T 51
+#define MS_STATE_LIGHT_HSL_RANGE_T 52
+#define MS_STATE_LIGHT_XYL_T 53
+#define MS_STATE_LIGHT_XYL_TARGET_T 54
+#define MS_STATE_LIGHT_XYL_DEFAULT_T 55
+#define MS_STATE_LIGHT_XYL_RANGE_T 56
+#define MS_STATE_LIGHT_LC_MODE_T 57
+#define MS_STATE_LIGHT_LC_OM_T 58
+#define MS_STATE_LIGHT_LC_LIGHT_ONOFF_T 59
+#define MS_STATE_LIGHT_LC_PROPERTY_ID_T 60
+#define MS_STATE_LIGHT_LC_PROPERTY_T 61
+
+#define MS_STATE_GENERIC_USER_PROPERTY_IDS_T 62
+#define MS_STATE_GENERIC_ADMIN_PROPERTY_IDS_T 63
+#define MS_STATE_GENERIC_MANUFACTURER_PROPERTY_IDS_T 64
+#define MS_STATE_GENERIC_CLIENT_PROPERTY_IDS_T 65
+
+#define MS_STATE_SCENE_STORE_T 66
+#define MS_STATE_SCENE_RECALL_T 67
+#define MS_STATE_SCENE_DELETE_T 68
+
+#define MS_STATE_DELTA_LEVEL_T 69
+#define MS_STATE_MOVE_LEVEL_T 70
+
+/* Additional supporting structure type defines */
+#define MS_EXT_TID_AND_TRANSITION_STRUCT_T 128
+#define MS_EXT_STATUS_STRUCT_T 129
+#define MS_STATE_SENSOR_SERIES_T 130
+
+/**
+ Generic OnOff state is a Boolean value that represents the state of an
+ element
+*/
+typedef struct MS_state_generic_onoff_struct
+{
+ /** Generic On/Off */
+ UINT8 onoff;
+
+ /** Target On/Off - Used in response path */
+ UINT8 target_onoff;
+
+ /** Last On/Off */
+ UINT8 last_onoff;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+ /** Transition Timer Handle */
+ UINT16 transition_time_handle;
+
+} MS_STATE_GENERIC_ONOFF_STRUCT;
+
+/**
+ Generic Level state is a 16-bit signed integer (2-s complement) representing
+ the state of an element
+*/
+typedef struct MS_state_generic_level_struct
+{
+ /** Generic Level */
+ UINT16 level;
+
+ /** Delta Level */
+ UINT32 delta_level;
+
+ /** Move Level */
+ UINT16 move_level;
+
+ /* TID - Used in received path */
+ UINT8 tid;
+
+ /* Optional */
+ /* Transition Time */
+ UINT8 transition_time;
+
+ /* Delay */
+ UINT8 delay;
+
+ /** Target Level */
+ UINT16 target_level;
+
+} MS_STATE_GENERIC_LEVEL_STRUCT;
+
+/**
+ Generic Default Transition Time state determines how long an element shall
+ take to transition from a present state to a new state
+*/
+typedef struct MS_state_generic_default_transition_time_struct
+{
+ /** The number of Steps */
+ UCHAR default_transition_number_of_steps;
+
+ /** The resolution of the Default Transition Number of Steps field */
+ UCHAR default_transition_step_resolution;
+} MS_STATE_GENERIC_DEFAULT_TRANSITION_TIME_STRUCT;
+
+/**
+ Generic OnPowerUp state is an enumeration representing the behavior of an
+ element when powered up
+*/
+typedef struct MS_state_generic_onpowerup_struct
+{
+ /** Generic OnPowerUp */
+ UCHAR onpowerup;
+} MS_STATE_GENERIC_ONPOWERUP_STRUCT;
+
+/**
+ Generic Power Actual state determines the linear percentage of the maximum
+ power level of an element, representing a range from 0 percent through 100
+ percent
+*/
+typedef struct MS_state_generic_power_actual_struct
+{
+ /** Generic Power Actual */
+ UINT16 power_actual;
+
+ /* TID - Used only in request path */
+ UINT8 tid;
+
+ /** Generic Power Target - Used only in response path */
+ UINT16 power_target;
+
+ /**
+ Transition Time - Used in request path
+ Used as Remaining Time in response path
+ */
+ UINT8 transition_time;
+
+ /* Delay - Used only in request path */
+ UINT8 delay;
+
+ /** Transition Timer Handle */
+ UINT16 transition_time_handle;
+
+} MS_STATE_GENERIC_POWER_ACTUAL_STRUCT;
+
+/**
+ Generic Power Last state is a 16-bit value representing a percentage ranging
+ from (1/65535) percent to 100 percent
+*/
+typedef struct MS_state_generic_power_last_struct
+{
+ /** Generic Power Last */
+ UINT16 power_last;
+} MS_STATE_GENERIC_POWER_LAST_STRUCT;
+
+/** Generic Power Default state is a 16-bit value ranging from 0 through 65535 */
+typedef struct MS_state_generic_power_default_struct
+{
+ /** Generic Power Default */
+ UINT16 power_default;
+} MS_STATE_GENERIC_POWER_DEFAULT_STRUCT;
+
+/**
+ Generic Power Range state determines the minimum and maximum power levels of
+ an element relative to the maximum power level an element can output
+*/
+typedef struct MS_state_generic_power_range_struct
+{
+ /** Generic Power Range - Minimum */
+ UINT16 power_range_min;
+
+ /** Generic Power Range - Maximum */
+ UINT16 power_range_max;
+
+ /** Status - Used only in the response path */
+ UINT8 status;
+
+} MS_STATE_GENERIC_POWER_RANGE_STRUCT;
+
+/**
+ Generic Power Level state is a composite state that includes a Generic Power
+ Actual state, a Generic Power Last state, a Generic Power Default state, and
+ a Generic Power Range state
+*/
+typedef struct MS_state_generic_power_level_struct
+{
+ /** Generic Power Actual */
+ MS_STATE_GENERIC_POWER_ACTUAL_STRUCT generic_power_actual;
+
+ /** Generic Power Last */
+ MS_STATE_GENERIC_POWER_LAST_STRUCT generic_power_last;
+
+ /** Generic Power Default */
+ MS_STATE_GENERIC_POWER_DEFAULT_STRUCT generic_power_default;
+
+ /** Generic Power Range */
+ MS_STATE_GENERIC_POWER_RANGE_STRUCT generic_power_range;
+} MS_STATE_GENERIC_POWER_LEVEL_STRUCT;
+
+/**
+ Generic Battery state is a set of four values representing the state of a
+ battery
+*/
+typedef struct MS_state_generic_battery_struct
+{
+ /**
+ Generic Battery Level state is a value ranging from 0 percent through 100
+ percent
+ */
+ UCHAR generic_battery_level;
+
+ /**
+ Generic Battery Time to Discharge state is a 24-bit unsigned value ranging
+ from 0 through 0xFFFFFF
+ */
+ UINT32 generic_battery_time_to_discharge;
+
+ /**
+ Generic Battery Time to Charge state is a 24-bit unsigned value ranging from
+ 0 through 0xFFFFFF
+ */
+ UINT32 generic_battery_time_to_charge;
+
+ /**
+ Generic Battery Flags state is a concatenation of four 2-bit bit fields:
+ Presence, Indicator, Charging, and Serviceability
+ */
+ UCHAR generic_battery_flags;
+} MS_STATE_GENERIC_BATTERY_STRUCT;
+
+/** Generic Global Location state defines location information of an element */
+typedef struct MS_state_generic_location_global_struct
+{
+ /** Global Coordinates (Latitude) */
+ UINT32 global_latitude;
+
+ /** Global Coordinates (Longitude) */
+ UINT32 global_longitude;
+
+ /** Global Altitude */
+ UINT16 global_altitude;
+} MS_STATE_GENERIC_LOCATION_GLOBAL_STRUCT;
+
+/** Generic Local Location state defines location information of an element */
+typedef struct MS_state_generic_location_local_struct
+{
+ /** Local Coordinates (North) */
+ UINT16 local_north;
+
+ /** Local Coordinates (East) */
+ UINT16 local_east;
+
+ /** Local Altitude */
+ UINT16 local_altitude;
+
+ /** Floor Number */
+ UCHAR floor_number;
+
+ /** Uncertainty */
+ UINT16 uncertainty;
+} MS_STATE_GENERIC_LOCATION_LOCAL_STRUCT;
+
+/**
+ Generic Location state is a composite state that includes a Generic Location
+ Global state and a Generic Location Local state
+*/
+typedef struct MS_state_generic_location_struct
+{
+ /** Global Location */
+ MS_STATE_GENERIC_LOCATION_GLOBAL_STRUCT global_location;
+
+ /** Local Location */
+ MS_STATE_GENERIC_LOCATION_LOCAL_STRUCT local_location;
+} MS_STATE_GENERIC_LOCATION_STRUCT;
+
+
+/**
+ Generic Property is a state representing a device property of an element.
+ The properties can be one of the following
+ - Manufacturer Properties
+ - Admin Properties
+ - User Properties
+*/
+typedef struct MS_state_generic_property_struct
+{
+ /**
+ User Property ID field is a 2-octet Assigned Number value referencing a
+ property
+ */
+ UINT16 property_id;
+
+ /** Property Type - Manufacturer/Admin/User */
+ UINT8 property_type;
+
+ /**
+ User Access field is an enumeration indicating whether the device property
+ can be read or written as a Generic Admin/User Property
+ */
+ UCHAR access;
+
+ /** User Property Value field is a conditional field */
+ UCHAR* property_value;
+ UINT16 property_value_len;
+
+} MS_STATE_GENERIC_PROPERTY_STRUCT;
+
+
+/** Generic User Property is a state representing a device property of an element */
+typedef struct MS_state_generic_user_property_struct
+{
+ /**
+ User Property ID field is a 2-octet Assigned Number value referencing a
+ device property
+ */
+ UINT16 property_id;
+
+ /**
+ User Access field is an enumeration indicating whether the device property
+ can be read or written as a Generic User Property
+ */
+ UCHAR user_access;
+
+ /** User Property Value field is a conditional field */
+ UCHAR* property_value;
+ UINT16 property_value_len;
+} MS_STATE_GENERIC_USER_PROPERTY_STRUCT;
+
+/**
+ Generic Admin Property is a state representing a device property of an
+ element that can be read or written
+*/
+typedef struct MS_state_generic_admin_property_struct
+{
+ /**
+ Admin Property ID field is a 2-octet Assigned Number value referencing a
+ device property
+ */
+ UINT16 property_id;
+
+ /**
+ Admin User Access field is an enumeration indicating whether the device
+ property can be read or written as a Generic User Property
+ */
+ UCHAR user_access;
+
+ /** Admin Property Value field is a conditional field */
+ UCHAR* property_value;
+ UINT16 property_value_len;
+} MS_STATE_GENERIC_ADMIN_PROPERTY_STRUCT;
+
+/**
+ Generic Manufacturer Property is a state representing a device property of an
+ element that is programmed by a manufacturer and can be read
+*/
+typedef struct MS_state_generic_manufacturer_property_struct
+{
+ /**
+ Manufacturer Property ID field is a 2-octet Assigned Number value that
+ references a device property
+ */
+ UINT16 property_id;
+
+ /**
+ Manufacturer User Access field is an enumeration indicating whether or not
+ the device property can be read as a Generic User Property
+ */
+ UCHAR user_access;
+
+ /** Manufacturer Property Value field is a conditional field */
+ UCHAR* property_value;
+ UINT16 property_value_len;
+} MS_STATE_GENERIC_MANUFACTURER_PROPERTY_STRUCT;
+
+/**
+ Generic Property ID a read-only state representing a device property that an
+ element supports
+*/
+typedef struct MS_state_generic_property_id_struct
+{
+ /**
+ Property ID field is a 2-octet Assigned Number value that references a device
+ property
+ */
+ UINT16 property_id;
+} MS_STATE_GENERIC_PROPERTY_ID_STRUCT;
+
+/**
+ Generic Property IDs a state representing a set of device properties that an
+ element supports
+*/
+typedef struct MS_state_generic_property_ids_struct
+{
+ /**
+ Property IDs field is a set of 2-octet Assigned Number value that references
+ a set of device properties
+ */
+ UINT16* property_ids;
+ UINT16 property_ids_count;
+} MS_STATE_GENERIC_PROPERTY_IDS_STRUCT;
+
+/**
+ Sensor Property ID field is a 2-octet value referencing a device property
+ that describes the meaning and the format of data reported by a sensor
+*/
+typedef struct MS_state_sensor_property_id_struct
+{
+ /**
+ Sensor Property ID field is a 2-octet value referencing a device property
+ that describes the meaning and the format of data reported by a sensor
+ */
+ UINT16 property_id;
+} MS_STATE_SENSOR_PROPERTY_ID_STRUCT;
+
+/** Sensor Descriptor state represents the attributes describing the sensor data */
+typedef struct MS_state_sensor_descriptor_struct
+{
+ /**
+ Sensor Property ID field is a 2-octet value referencing a device property
+ that describes the meaning and the format of data reported by a sensor
+ */
+ UINT16 sensor_property_id;
+
+ /**
+ Sensor Positive Tolerance field is a 12-bit value representing the magnitude
+ of a possible positive error associated with the measurements that the sensor
+ is reporting
+ */
+ UINT16 sensor_positive_tolerance;
+
+ /**
+ Sensor Negative Tolerance field is a 12-bit value representing the magnitude
+ of a possible negative error associated with the measurements that the sensor
+ is reporting
+ */
+ UINT16 sensor_negative_tolerance;
+
+ /**
+ Sensor Sampling Function field specifies the averaging operation or type of
+ sampling function applied to the measured value
+ */
+ UCHAR sensor_sampling_function;
+
+ /**
+ Sensor Measurement Period field specifies a uint8 value n that represents the
+ averaging time span, accumulation time, or measurement period in seconds over
+ which the measurement is taken
+ */
+ UCHAR sensor_measurement_period;
+
+ /**
+ measurement reported by a sensor is internally refreshed at the frequency
+ indicated in the Sensor Update Interval field
+ */
+ UCHAR sensor_update_interval;
+
+ /** Status - used in response to indicate if other fields to be included */
+ UINT8 status;
+
+} MS_STATE_SENSOR_DESCRIPTOR_STRUCT;
+
+/** Sensor Settings state controls parameters of a sensor */
+typedef struct MS_state_sensor_settings_struct
+{
+ /** Property ID of a sensor */
+ UINT16 sensor_property_id;
+
+ /** Property ID of a setting within a sensor */
+ UINT16* setting_property_ids;
+ UINT16 setting_property_ids_count;
+
+} MS_STATE_SENSOR_SETTINGS_STRUCT;
+
+/** Sensor Setting state controls parameters of a sensor */
+typedef struct MS_state_sensor_setting_struct
+{
+ /** Property ID of a sensor */
+ UINT16 sensor_property_id;
+
+ /** Property ID of a setting within a sensor */
+ UINT16 sensor_setting_property_id;
+
+ /** Read/Write access rights for the setting */
+ UCHAR sensor_setting_access;
+
+ /** Raw value of a setting within a sensor */
+ UCHAR* sensor_setting_raw;
+ UINT16 sensor_setting_raw_len;
+
+ /* Status - used in response path */
+ UINT8 status;
+
+} MS_STATE_SENSOR_SETTING_STRUCT;
+
+/** Sensor Cadence state controls the cadence of sensor reports */
+typedef struct MS_state_sensor_cadence_struct
+{
+ /** Property ID of a sensor */
+ UINT16 sensor_property_id;
+
+ /** Divisor for the Publish Period */
+ UCHAR fast_cadence_period_divisor;
+
+ /** Defines the unit and format of the Status Trigger Delta fields */
+ UCHAR status_trigger_type;
+
+ /** Delta down value that triggers a status message */
+ UCHAR* status_trigger_delta_down;
+ UINT16 status_trigger_delta_down_len;
+
+ /** Delta up value that triggers a status message */
+ UCHAR* status_trigger_delta_up;
+ UINT16 status_trigger_delta_up_len;
+
+ /** Minimum interval between two consecutive Status messages */
+ UCHAR status_min_interval;
+
+ /** Low value for the fast cadence range */
+ UCHAR* fast_cadence_low;
+ UINT16 fast_cadence_low_len;
+
+ /** High value for the fast cadence range */
+ UCHAR* fast_cadence_high;
+ UINT16 fast_cadence_high_len;
+
+ /** Status - used in response path */
+ UINT8 status;
+
+} MS_STATE_SENSOR_CADENCE_STRUCT;
+
+/**
+ The Sensor Data state is a sequence of one or more pairs of Sensor Property
+ ID and Raw Value fields, with each Raw Value field size and representation
+ defined by the characteristics referenced by the Sensor Property ID
+*/
+typedef struct MS_state_sensor_data_struct
+{
+ /** ID of the 1st device property of the sensor */
+ UINT16 property_id_1;
+
+ /**
+ Raw Value field with a size and representation defined by the 1st device
+ property
+ */
+ UCHAR* raw_value_1;
+ UINT16 raw_value_1_len;
+
+ /** ID of the 2nd device property of the sensor */
+ UINT16 property_id_2;
+
+ /**
+ Raw Value field with a size and representation defined by the 2nd device
+ property
+ */
+ UCHAR* raw_value_2;
+ UINT16 raw_value_2_len;
+
+ /** ID of the nth device property of the sensor */
+ UINT16 property_id_n;
+
+ /**
+ Raw Value field with a size and representation defined by the nth device
+ property
+ */
+ UCHAR* raw_value_n;
+ UINT16 raw_value_n_len;
+
+ /** Status - used in response path */
+ UINT8 status;
+
+} MS_STATE_SENSOR_DATA_STRUCT;
+
+/**
+ Values measured by sensors may be organized as arrays (and represented as
+ series of columns, such as histograms
+*/
+typedef struct MS_state_sensor_series_column_struct
+{
+ /** Property describing the data series of the sensor */
+ UINT16 sensor_property_id;
+
+ /** Raw value representing the left corner of a column on the X axis */
+ UCHAR* sensor_raw_value_x;
+ UINT16 sensor_raw_value_x_len;
+
+ /** Raw value representing the width of the column */
+ UCHAR* sensor_column_width;
+ UINT16 sensor_column_width_len;
+
+ /** Raw value representing the height of the column on the Y axis */
+ UCHAR* sensor_raw_value_y;
+ UINT16 sensor_raw_value_y_len;
+
+ /** Status - used in response path */
+ UINT8 status;
+
+} MS_STATE_SENSOR_SERIES_COLUMN_STRUCT;
+
+/**
+ Mesh defines times based on International Atomic Time (TAI). The base
+ representation of times is the number of seconds after 00:00:00 TAI on
+ 2000-01-01 (that is, 1999-12-31T23:59:28 UTC)
+*/
+typedef struct MS_state_time_struct
+{
+ /** Current TAI time in seconds since the epoch. */
+ UCHAR tai_seconds[5];
+
+ /** The sub-second time in units of 1/256s. */
+ UCHAR subsecond;
+
+ /** Estimated uncertainty in 10-millisecond steps. */
+ UCHAR uncertainty;
+
+ /**
+ 0 = No Time Authority. The element does not have a trusted OOB source of
+ time, such as GPS or NTP. 1 = Time Authority. The element has a trusted OOB
+ source of time, such as GPS or NTP or a battery-backed, properly initialized
+ RTC.
+ */
+ UCHAR time_authority;
+
+ /** Current difference between TAI and UTC in seconds */
+ UINT16 tai_utc_delta;
+
+ /** The local time zone offset in 15-minute increments */
+ UCHAR time_zone_offset;
+} MS_STATE_TIME_STRUCT;
+
+/** Time Zone */
+typedef struct MS_state_time_zone_struct
+{
+ /**
+ Current local time zone offset.
+ Meaningful only in 'Time Zone Status' response.
+ */
+ UCHAR time_zone_offset_current;
+
+ /** Upcoming local time zone offset. */
+ UCHAR time_zone_offset_new;
+
+ /** Absolute TAI time when the Time Zone Offset will change from Current to New. */
+ UCHAR tai_of_zone_change[5];
+} MS_STATE_TIME_ZONE_STRUCT;
+
+/** TAI-UTC Delta */
+typedef struct MS_state_time_tai_utc_delta_struct
+{
+ /**
+ Current difference between TAI and UTC in seconds.
+ Meaningful only in 'TAI-UTC Delta Status' response.
+ */
+ UINT16 tai_utc_delta_current;
+
+ /** Upcoming difference between TAI and UTC in seconds. */
+ UINT16 tai_utc_delta_new;
+
+ /** Always 0b0. Other values are Prohibited. */
+ UCHAR padding;
+
+ /** TAI Seconds time of the upcoming TAI-UTC Delta change */
+ UCHAR tai_of_delta_change[5];
+} MS_STATE_TIME_TAI_UTC_DELTA_STRUCT;
+
+/** The Time Role state of an element */
+typedef struct MS_state_time_role_struct
+{
+ /** Time Role */
+ UCHAR role;
+} MS_STATE_TIME_ROLE_STRUCT;
+
+/** The state to identify a scene */
+typedef struct MS_state_scene_number_struct
+{
+ /** The number to identify a scene */
+ UINT16 number;
+} MS_STATE_SCENE_NUMBER_STRUCT;
+
+/** The current status of a currently active scene */
+typedef struct MS_state_scene_status_struct
+{
+ /** Status Code */
+ UCHAR status_code;
+
+ /** Scene Number of a current scene. */
+ UINT16 current_scene;
+
+ /** Scene Number of a target scene. */
+ UINT16 target_scene;
+
+ /* Remaining Time */
+ UINT8 remaining_time;
+
+} MS_STATE_SCENE_STATUS_STRUCT;
+
+/** The current status of scene register */
+typedef struct MS_state_scene_register_status_struct
+{
+ /** Status Code */
+ UCHAR status_code;
+
+ /** Scene Number of a current scene. */
+ UINT16 current_scene;
+
+ /** A list of scenes stored within an element */
+ UINT16* scenes;
+ UINT16 scenes_count;
+} MS_STATE_SCENE_REGISTER_STATUS_STRUCT;
+
+/** The current Schedule Register state of an element. */
+typedef struct MS_state_scheduler_schedules_struct
+{
+ /** Bit field indicating defined Actions in the Schedule Register */
+ UINT16 schedules;
+} MS_STATE_SCHEDULER_SCHEDULES_STRUCT;
+
+/** The entry index of the Schedule Register state */
+typedef struct MS_state_scheduler_entry_index_struct
+{
+ /** Index of the Schedule Register entry */
+ UCHAR index;
+} MS_STATE_SCHEDULER_ENTRY_INDEX_STRUCT;
+
+/** The entry of the Schedule Register state */
+typedef struct MS_state_scheduler_entry_struct
+{
+ /** Index of the Schedule Register entry */
+ UCHAR index;
+
+ /** Scheduled year for the action */
+ UCHAR year;
+
+ /** Scheduled month for the action */
+ UINT16 month;
+
+ /** Scheduled day of the month for the action */
+ UCHAR day;
+
+ /** Scheduled hour for the action */
+ UCHAR hour;
+
+ /** Scheduled minute for the action */
+ UCHAR minute;
+
+ /** Scheduled second for the action */
+ UCHAR second;
+
+ /** Schedule days of the week for the action */
+ UCHAR dayofweek;
+
+ /** Action to be performed at the scheduled time */
+ UCHAR action;
+
+ /** Transition time for this action */
+ UCHAR transition_time;
+
+ /** Scene number to be used for some actions */
+ UINT16 scene_number;
+
+} MS_STATE_SCHEDULER_ENTRY_STRUCT;
+
+/**
+ Light Lightness Linear state represents the lightness of a light on a linear
+ scale
+*/
+typedef struct MS_state_light_lightness_linear_struct
+{
+ /** Light Lightness Linear */
+ UINT16 lightness_linear;
+
+ /** Light Lightness Target - Used in response path. */
+ UINT16 lightness_target;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+} MS_STATE_LIGHT_LIGHTNESS_LINEAR_STRUCT;
+
+/**
+ Light Lightness Actual state represents the lightness of a light on a
+ perceptually uniform lightness scale
+*/
+typedef struct MS_state_light_lightness_actual_struct
+{
+ /** Light Lightness Actual */
+ UINT16 lightness_actual;
+
+ /** Light Lightness Target - Used in response path. */
+ UINT16 lightness_target;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+ /** Transition Timer Handle */
+ UINT16 transition_time_handle;
+
+} MS_STATE_LIGHT_LIGHTNESS_ACTUAL_STRUCT;
+
+/**
+ Light Lightness Last state represents the lightness of a light on a
+ perceptually uniform lightness scale
+*/
+typedef struct MS_state_light_lightness_last_struct
+{
+ /** Light Lightness Last */
+ UINT16 lightness_last;
+} MS_STATE_LIGHT_LIGHTNESS_LAST_STRUCT;
+
+/**
+ Light Lightness Default state is a value ranging from 0x0000 to 0xFFFF,
+ representing a default lightness level for the Light Lightness Actual state
+*/
+typedef struct MS_state_light_lightness_default_struct
+{
+ /** Light Lightness Default */
+ UINT16 lightness_default;
+} MS_STATE_LIGHT_LIGHTNESS_DEFAULT_STRUCT;
+
+/**
+ Light Lightness Range state determines the minimum and maximum lightness of
+ an element
+*/
+typedef struct MS_state_light_lightness_range_struct
+{
+ /** Light Lightness Range Min */
+ UINT16 lightness_range_min;
+
+ /** Light Lightness Range Max */
+ UINT16 lightness_range_max;
+} MS_STATE_LIGHT_LIGHTNESS_RANGE_STRUCT;
+
+/**
+ Light Lightness state is a composite state that includes the Light Lightness
+ Linear, the Light Lightness Actual, the Light Lightness Last, and the Light
+ Lightness Default states
+*/
+typedef struct MS_state_light_lightness_struct
+{
+ /**
+ Light Lightness Linear state represents the lightness of a light on a linear
+ scale
+ */
+ MS_STATE_LIGHT_LIGHTNESS_LINEAR_STRUCT light_lightness_linear;
+
+ /**
+ Light Lightness Actual state represents the lightness of a light on a
+ perceptually uniform lightness scale
+ */
+ MS_STATE_LIGHT_LIGHTNESS_ACTUAL_STRUCT light_lightness_actual;
+
+ /**
+ Light Lightness Last state represents the lightness of a light on a
+ perceptually uniform lightness scale
+ */
+ MS_STATE_LIGHT_LIGHTNESS_LAST_STRUCT light_lightness_last;
+
+ /**
+ Light Lightness Default state is a value ranging from 0x0000 to 0xFFFF,
+ representing a default lightness level for the Light Lightness Actual state
+ */
+ MS_STATE_LIGHT_LIGHTNESS_DEFAULT_STRUCT light_lightness_default;
+
+ /**
+ Light Lightness Range state.
+ */
+ MS_STATE_LIGHT_LIGHTNESS_RANGE_STRUCT light_lightness_range;
+
+ /** Status field used only for the Range Status */
+ UINT8 range_status;
+
+} MS_STATE_LIGHT_LIGHTNESS_STRUCT;
+
+/**
+ Light CTL state is a composite state that includes the Light CTL Lightness,
+ the Light CTL Temperature and the Light CTL Delta UV states
+*/
+typedef struct MS_state_light_ctl_struct
+{
+ /** Light CTL Lightness */
+ UINT16 ctl_lightness;
+
+ /** Target Light CTL Lightness - Used in response path */
+ UINT16 target_ctl_lightness;
+
+ /** Light CTL Temperature */
+ UINT16 ctl_temperature;
+
+ /** Terget Light CTL Temperature - Used in response path */
+ UINT16 target_ctl_temperature;
+
+ /** Light CTL Delta UV */
+ UINT16 ctl_delta_uv;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+} MS_STATE_LIGHT_CTL_STRUCT;
+
+/**
+ Light CTL Default state is a composite state that includes the Light CTL
+ Lightness, the Light CTL Temperature and the Light CTL Delta UV states
+*/
+typedef struct MS_state_light_ctl_default_struct
+{
+ /** Light CTL Lightness */
+ UINT16 ctl_lightness;
+
+ /** Light CTL Temperature */
+ UINT16 ctl_temperature;
+
+ /** Light CTL Delta UV */
+ UINT16 ctl_delta_uv;
+} MS_STATE_LIGHT_CTL_DEFAULT_STRUCT;
+
+/**
+ Light CTL Temperature state is a composite state that includes the Light CTL
+ Temperature and the Light CTL Delta UV states
+*/
+typedef struct MS_state_light_ctl_temperature_struct
+{
+ /** Light CTL Temperature */
+ UINT16 ctl_temperature;
+
+ /** Target Light CTL Temperature - Used in response path */
+ UINT16 target_ctl_temperature;
+
+ /** Light CTL Delta UV */
+ UINT16 ctl_delta_uv;
+
+ /** Target Light CTL Delta UV - Used in response path */
+ UINT16 target_ctl_delta_uv;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+} MS_STATE_LIGHT_CTL_TEMPERATURE_STRUCT;
+
+/**
+ Light CTL Temperature Range state determines the minimum and maximum color
+ temperatures of tunable white light an element is capable of emitting
+*/
+typedef struct MS_state_light_ctl_temperature_range_struct
+{
+ /** CTL Temperature Range Min */
+ UINT16 ctl_temperature_range_min;
+
+ /** CTL Temperature Range Max */
+ UINT16 ctl_temperature_range_max;
+
+ /** Status - Used in response path */
+ UINT8 status;
+
+} MS_STATE_LIGHT_CTL_TEMPERATURE_RANGE_STRUCT;
+
+/**
+ Light HSL state is a composite state that includes the Light HSL Lighness,
+ the Light HSL Hue and the Light HSL Saturation states
+*/
+typedef struct MS_state_light_hsl_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 hsl_lightness;
+
+ /** Target Perceived lightness - used in the response path */
+ UINT16 target_hsl_lightness;
+
+ /** The 16-bit value representing the hue */
+ UINT16 hsl_hue;
+
+ /** Target hue - used in the response path */
+ UINT16 target_hsl_hue;
+
+ /** The saturation of a color light */
+ UINT16 hsl_saturation;
+
+ /** Target saturation - used in the response path */
+ UINT16 target_hsl_saturation;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+ /** Transition Timer Handle */
+ UINT16 transition_time_handle;
+
+} MS_STATE_LIGHT_HSL_STRUCT;
+
+/**
+ Light HSL Target state is a composite state that includes the Light HSL
+ Lighness, the Light HSL Hue and the Light HSL Saturation states
+*/
+typedef struct MS_state_light_hsl_target_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 hsl_lightness;
+
+ /** The 16-bit value representing the hue */
+ UINT16 hsl_hue;
+
+ /** The saturation of a color light */
+ UINT16 hsl_saturation;
+} MS_STATE_LIGHT_HSL_TARGET_STRUCT;
+
+/**
+ Light HSL Default state is a composite state that includes the Light HSL
+ Lighness, the Light HSL Hue and the Light HSL Saturation states
+*/
+typedef struct MS_state_light_hsl_default_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 hsl_lightness;
+
+ /** The 16-bit value representing the hue */
+ UINT16 hsl_hue;
+
+ /** The saturation of a color light */
+ UINT16 hsl_saturation;
+} MS_STATE_LIGHT_HSL_DEFAULT_STRUCT;
+
+/** Light HSL Hue */
+typedef struct MS_state_light_hsl_hue_struct
+{
+ /** The 16-bit value representing the hue */
+ UINT16 hsl_hue;
+} MS_STATE_LIGHT_HSL_HUE_STRUCT;
+
+/** Light HSL Saturation */
+typedef struct MS_state_light_hsl_saturation_struct
+{
+ /** The saturation of a color light */
+ UINT16 hsl_saturation;
+} MS_STATE_LIGHT_HSL_SATURATION_STRUCT;
+
+/**
+ Light HSL Range state is a composite state that includes Minimum and Maximum
+ of the Light HSL Hue and the Light HSL Saturation states
+*/
+typedef struct MS_state_light_hsl_range_struct
+{
+ /** The value of the Hue Range Min field of the Light HSL Hue Range state */
+ UINT16 hue_range_min;
+
+ /** The value of the Hue Range Max field of the Light HSL Hue Range state */
+ UINT16 hue_range_max;
+
+ /**
+ The value of the Saturation Range Min field of the Light HSL Saturation Range
+ state
+ */
+ UINT16 saturation_range_min;
+
+ /**
+ The value of the Saturation Range Max field of the Light HSL Saturation Range
+ state
+ */
+ UINT16 saturation_range_max;
+
+ /** Status - Used only in response path */
+ UINT8 status;
+
+} MS_STATE_LIGHT_HSL_RANGE_STRUCT;
+
+/**
+ Light xyL state is a composite state that includes the xyL Lightness, the
+ Light xyL x and the Light xyL y states
+*/
+typedef struct MS_state_light_xyl_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 xyl_lightness;
+
+ /** Target perceived lightness - used in response path */
+ UINT16 target_xyl_lightness;
+
+ /** The 16-bit value representing the x coordinate of a CIE1931 color light */
+ UINT16 xyl_x;
+
+ /** Target x coordinate - used in response path */
+ UINT16 target_xyl_x;
+
+ /** The 16-bit value representing the y coordinate of a CIE1931 color light */
+ UINT16 xyl_y;
+
+ /** Target y coordinate - used in response path */
+ UINT16 target_xyl_y;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+ /** Transition Timer Handle */
+ UINT16 transition_time_handle;
+
+} MS_STATE_LIGHT_XYL_STRUCT;
+
+/**
+ Light xyL target state is a composite state that includes the xyL Lightness,
+ the Light xyL x and the Light xyL y states
+*/
+typedef struct MS_state_light_xyl_target_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 xyl_lightness;
+
+ /** The 16-bit value representing the x coordinate of a CIE1931 color light */
+ UINT16 xyl_x;
+
+ /** The 16-bit value representing the y coordinate of a CIE1931 color light */
+ UINT16 xyl_y;
+} MS_STATE_LIGHT_XYL_TARGET_STRUCT;
+
+/**
+ Light xyL default state is a composite state that includes the xyL Lightness,
+ the Light xyL x and the Light xyL y states
+*/
+typedef struct MS_state_light_xyl_default_struct
+{
+ /** The perceived lightness of a light emitted by the element */
+ UINT16 xyl_lightness;
+
+ /** The 16-bit value representing the x coordinate of a CIE1931 color light */
+ UINT16 xyl_x;
+
+ /** The 16-bit value representing the y coordinate of a CIE1931 color light */
+ UINT16 xyl_y;
+} MS_STATE_LIGHT_XYL_DEFAULT_STRUCT;
+
+/**
+ Light xyL Range state determines the minimum and maximum values of the Light
+ xyL x and syL y state of an element
+*/
+typedef struct MS_state_light_xyl_range_struct
+{
+ /** The minimum value of a Light xyL x state of an element */
+ UINT16 xyl_x_range_min;
+
+ /** The maximum value of a Light xyL x state of an element */
+ UINT16 xyl_x_range_max;
+
+ /** The minimum value of a Light xyL y state of an element */
+ UINT16 xyl_y_range_min;
+
+ /** The maximum value of a Light xyL y state of an element */
+ UINT16 xyl_y_range_max;
+
+ /** Status - Used in the response path */
+ UINT8 status;
+
+} MS_STATE_LIGHT_XYL_RANGE_STRUCT;
+
+/** Light LC Mode state */
+typedef struct MS_state_light_lc_mode_struct
+{
+ /** Light LC Mode state - present */
+ UCHAR present_mode;
+
+ /** Light LC Mode state - target */
+ UCHAR target_mode;
+
+} MS_STATE_LIGHT_LC_MODE_STRUCT;
+
+/** Light LC Occupancy Mode state */
+typedef struct MS_state_light_lc_om_struct
+{
+ /** Light LC Occupancy Mode state - present */
+ UCHAR present_mode;
+
+ /** Light LC Occupancy Mode state - target */
+ UCHAR target_mode;
+
+} MS_STATE_LIGHT_LC_OM_STRUCT;
+
+/** Light LC Light OnOff State */
+typedef struct MS_state_light_lc_light_onoff_struct
+{
+ /** Light LC Light OnOff State */
+ UCHAR present_light_onoff;
+
+ /** Light LC Light OnOff State */
+ UCHAR target_light_onoff;
+
+ /** TID - Used in request path */
+ UINT8 tid;
+
+ /**
+ Transition Time - Used in request path.
+ Used as remaining time in response path.
+ */
+ UINT8 transition_time;
+
+ /** Delay - Used in request path */
+ UINT8 delay;
+
+} MS_STATE_LIGHT_LC_LIGHT_ONOFF_STRUCT;
+
+/** Property ID identifying a Light LC Property */
+typedef struct MS_state_light_lc_property_id_struct
+{
+ /** Property ID identifying a Light LC Property */
+ UINT16 property_id;
+} MS_STATE_LIGHT_LC_PROPERTY_ID_STRUCT;
+
+/** Light LC Property state */
+typedef struct MS_state_light_lc_property_struct
+{
+ /** Property ID identifying a Light LC Property */
+ UINT16 property_id;
+
+ /** Raw value for the Light LC Property */
+ UCHAR* property_value;
+ UINT16 property_value_len;
+} MS_STATE_LIGHT_LC_PROPERTY_STRUCT;
+
+
+/* Additional supporting structure defines */
+
+/**
+ TID and Transition is a structure which contains Transaction ID (TID) as mandatory field.
+ Other two fields, Transition Time and Delay are optional.
+
+ TID field is a transaction identifier indicating whether the message is a new message or
+ a retransmission of a previously sent message.
+
+ If present, the Transition Time field identifies the time that an element will take
+ to transition to the target state from the present state.
+
+ The Delay field shall be present when the Transition Time field is present.
+ It identifies the message execution delay, representing a time interval between receiving
+ the message by a model and executing the associated model behaviors.
+*/
+typedef struct MS_ext_tid_and_transition_struct
+{
+ UCHAR tid;
+ UCHAR transition_time;
+ UCHAR delay;
+ UCHAR optional_fields_present;
+
+} MS_EXT_TID_AND_TRANSITION_STRUCT;
+
+/**
+ The Status Code field identifies the Status Code for the last operation.
+*/
+typedef struct MS_ext_status_struct
+{
+ UCHAR status;
+
+} MS_EXT_STATUS_STRUCT;
+
+/* State Transition data structure */
+typedef struct _MS_ACCESS_STATE_TRANSITION_TYPE
+{
+ /* Transition Timer */
+ EM_timer_handle transition_timer_handle;
+
+ /* Transition State. Initial/delay/transition */
+ UINT8 transition_state;
+
+ /* Delay */
+ UINT8 delay;
+
+ /* Transition Time */
+ UINT8 transition_time;
+
+ /* Transition Start Callback */
+ void (* transition_start_cb)(void*);
+
+ /* Transition Complete Callback */
+ void (* transition_complete_cb)(void*);
+
+ /* Blob/Context */
+ void* blob;
+
+} MS_ACCESS_STATE_TRANSITION_TYPE;
+
+/* --------------------------------------------- Function */
+#endif /*_H_MS_MODEL_STATES_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_net_api.h b/src/components/ethermind/mesh/export/include/MS_net_api.h
new file mode 100644
index 0000000..624bb07
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_net_api.h
@@ -0,0 +1,849 @@
+
+/**
+ \file MS_net_api.h
+
+ \brief This file defines the Mesh Network Layer Interface - includes
+ Data Structures and Methods.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_NET_API_
+#define _H_MS_NET_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+/* Bearer Layer */
+#include "MS_brr_api.h"
+#include "MS_prov_api.h"
+
+/* --------------------------------------------- Global Definitions */
+
+/**
+ \defgroup net_module NETWORK (Mesh Network Layer)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Network (NETWORK) module to the Application and other upper
+ layers of the stack.
+*/
+
+/**
+ \defgroup net_defines Defines
+ \{
+ Describes defines for the module.
+*/
+
+/**
+ \defgroup net_constants Constants
+ \{
+ Describes Constants defined by the module.
+*/
+
+/**
+ \defgroup net_addressing Addressing
+ \{
+ Describes five basic type of addresses, the Network Layer defines.
+*/
+
+/**
+ Unassigned Address.
+ An unassigned address is an address that means that the component of a node
+ has not been configured yet or no address has been allocated.
+
+ An unassigned address shall not be used in a source or destination address
+ field of a message.
+
+ A Primary Component shall not have an unassigned address.
+ A Secondary Component may have an unassigned address.
+ A component with an unassigned address is inactive (i.e., it cannot send
+ nor receive and process messages).
+*/
+#define MS_NET_ADDR_UNASSIGNED 0x0000
+/** Network Address Type - Invalid */
+#define MS_NET_ADDR_TYPE_INVALID 0x00
+
+/**
+ Unicast Address.
+ A unicast address is a unique address allocated to each component within a node.
+ A unicast address has bit 15 cleared to zero.
+ The unicast address shall not have the value 0x0000,
+ and therefore can have any value from 0x0001 to 0x7FFF inclusive.
+
+ A unicast address is allocated to a primary component of an unprovisioned
+ device by the Provisioner during provisioning for the lifetime of the node
+ on the network.
+
+ A unicast address can be allocated to any secondary component within
+ an already provisioned node.
+
+ A unicast address shall be used in the source address field of a message
+ and can be used in a destination address field of a message.
+ A message sent to a unicast address will be processed by at most one node
+ or one component within a node.
+*/
+/** Bitmask for Network Address Type - Unicast */
+#define MS_NET_ADDR_UNICAST_BIT_MASK 0x8000
+/** Comparison value for Network Address Type - Unicast */
+#define MS_NET_ADDR_UNICAST_COMPARE 0x0000
+/** Network Address Type - Unicast */
+#define MS_NET_ADDR_TYPE_UNICAST 0x01
+
+/**
+ Virtual Address.
+ A virtual address is an address that is similar to a group address,
+ in that multiple devices may know such an address.
+ This type of address is used to identify a label to which devices
+ may publish or subscribe.
+ The label referred to by a given virtual address is uniquely identified
+ by a 128-bit UUID, called virtual label UUID.
+
+ The format of a Virtual Address is 10vv vvvv vvvv vvvv.
+ The fourteen v-bits are the least significant bits of the following calculation:
+ v = AES-CMAC (virtual label UUID, "vtad")[0-13]
+*/
+/** Bitmask for Network Address Type - Virtual */
+#define MS_NET_ADDR_VIRTUAL_BIT_MASK 0xC000
+/** Comparison value for Network Address Type - Virtual */
+#define MS_NET_ADDR_VIRTUAL_COMPARE 0x8000
+/** Network Address Type - Virtual */
+#define MS_NET_ADDR_TYPE_VIRTUAL 0x02
+
+/**
+ Group Address.
+ A group address is an address that is programmed into zero or more nodes or
+ components within nodes.
+ A group address has bit 15 set to one and bit 14 set to one.
+ The group address shall not have the value 0xFFFF, and therefore can have
+ any value from 0xC000 to 0xFFFE.
+ A group address shall only be used in the destination address field of a message.
+ A message sent to a group address will be processed by all the nodes that know
+ this group address.
+*/
+/** Bitmask for Network Address Type - Group */
+#define MS_NET_ADDR_GROUP_BIT_MASK 0xC000
+/** Comparison value for Network Address Type - Group */
+#define MS_NET_ADDR_GROUP_COMPARE 0xC000
+/** Network Address Type - Group */
+#define MS_NET_ADDR_TYPE_GROUP 0x03
+
+/**
+ Fixed Group Addresses are all-proxies, all-friends, all-relays and all-nodes.
+
+ Note: Fixed Group Addresses in the range 0xFF00 - 0xFFFB are Reserved for Future.
+*/
+/** Fixed Group Address - All-Proxies */
+#define MS_NET_ADDR_ALL_PROXIES 0xFFFC
+/** Fixed Group Address - All-Friends */
+#define MS_NET_ADDR_ALL_FRIENDS 0xFFFD
+/** Fixed Group Address - All-Relays */
+#define MS_NET_ADDR_ALL_RELAYS 0xFFFE
+/** Fixed Group Address - All-Nodes */
+#define MS_NET_ADDR_ALL_NODES 0xFFFF
+
+/**
+ Address Validity
+
+ | Address Type | Valid in Source Address Field | Valid in Destination Address Field |
+ | :----------: | :----------------------------: | :--------------------------------: |
+ | Unassigned | No | No |
+ | Unicast | Yes | Yes |
+ | Virtual | No | Yes |
+ | Group | No | Yes |
+ | Broadcast | No | Yes |
+*/
+
+/** Network Layer Feature Idenfiers */
+/** Network Layer Feature - Proxy */
+#define MS_NET_FEATURE_PROXY 0x00
+/** Network Layer Feature - Relay */
+#define MS_NET_FEATURE_RELAY 0x01
+
+/** Primary Subnet - NetKey Index is 0x000 */
+#define MS_PRIMARY_SUBNET 0x000
+
+/** Invalid Subnet Handle */
+#define MS_INVALID_SUBNET_HANDLE 0xFFFF
+
+/** Invalid AppKey Handle */
+#define MS_INVALID_APPKEY_HANDLE 0xFFFF
+
+/** \} */
+
+/**
+ \defgroup net_proxy Proxy
+ \{
+ Describes Network Layer Proxy Feature related defines.
+*/
+/** GATT Proxy Filter Types */
+/** GATT Proxy Filter Type - Whitelist */
+#define MS_PROXY_WHITELIST_FILTER 0x00
+/** GATT Proxy Filter Type - Blacklist */
+#define MS_PROXY_BLACKLIST_FILTER 0x01
+
+/** GATT Proxy Configuration Opcodes */
+/** GATT Proxy Configuration - Set Filter Opcode */
+#define MS_PROXY_SET_FILTER_OPCODE 0x00
+/** GATT Proxy Configuration - Add to Filter Opcode */
+#define MS_PROXY_ADD_TO_FILTER_OPCODE 0x01
+/** GATT Proxy Configuration - Remove From Filter Opcode */
+#define MS_PROXY_REM_FROM_FILTER_OPCODE 0x02
+/** GATT Proxy Configuration - Filter Status Opcode */
+#define MS_PROXY_FILTER_STATUS_OPCODE 0x03
+
+/** GATT Proxy ADV Modes */
+/** Network ID Type */
+#define MS_PROXY_NET_ID_ADV_MODE 0x01
+/** Node Idetity Type */
+#define MS_PROXY_NODE_ID_ADV_MODE 0x02
+
+/** \} */
+
+/** \} */
+
+/**
+ \defgroup net_events Events
+ \{
+ This section lists the Asynchronous Events notified to Application by the
+ Module.
+*/
+
+/** GATT Proxy Events */
+/** GATT Proxy Event - Interface UP */
+#define MS_PROXY_UP_EVENT 0x00
+/** GATT Proxy Event - Interface Down */
+#define MS_PROXY_DOWN_EVENT 0x01
+/** GATT Proxy Event - Status */
+#define MS_PROXY_STATUS_EVENT 0x02
+
+/** \} */
+
+/**
+ \defgroup net_proxy states
+ \{
+ This section lists the various states of Proxy Module exposed by it to
+ other Modules.
+*/
+
+/**
+ GATT Proxy States.
+
+ | Proxy Callback | Proxy Iface | Error Code
+ |------------------|--------------|-------------------
+ | NULL | Down | MS_PROXY_NULL
+ | NULL | Up | MS_PROXY_NULL
+ | !NULL | Down | MS_PROXY_READY
+ | !NULL | UP | MS_PROXY_CONNECTED
+*/
+/** GATT Proxy State - Invalid/Not Initialized */
+#define MS_PROXY_NULL 0x00
+/** GATT Proxy State - Ready/Initialized */
+#define MS_PROXY_READY 0x01
+/** GATT Proxy State - Connected */
+#define MS_PROXY_CONNECTED 0x02
+
+
+/* Secure Beacon Network Timer (minimum of 10 s) */
+extern EM_timer_handle ms_snb_timer_handle;
+
+extern EM_timer_handle ms_iv_update_timer_handle;
+
+extern EM_timer_handle net_key_refresh_timer_handle;
+
+/* Secure Beacon Network Beacon Timeout value - default 10s */
+#define MS_SNB_TIMEOUT (10 * 1000) /* in ms */
+
+
+/** \} */
+/** \} */
+
+/**
+ \defgroup net_marcos Utility Macros
+ \{
+ Initialization and other Utility Macros offered by the module.
+*/
+
+/** \} */
+
+/* --------------------------------------------- Data Types/ Structures */
+
+/**
+ \addtogroup net_defines Defines
+ \{
+*/
+
+/**
+ \addtogroup net_structures Structures
+ \{
+*/
+
+/** Network Address Type */
+typedef UINT16 MS_NET_ADDR;
+
+/** Subnet Handle */
+typedef UINT16 MS_SUBNET_HANDLE;
+
+/** AppKey Handle */
+typedef UINT16 MS_APPKEY_HANDLE;
+
+/** Address Type */
+typedef UCHAR MS_NET_ADDR_TYPE;
+
+/** Network Header Type */
+typedef struct _MS_NET_HEADER
+{
+ /** Least significant bit of IV Index - 1 bit */
+ UINT8 ivi;
+
+ /**
+ Value derived from the NetKey used to identify
+ the Encrytion Key and Privacy Key used to secure
+ this PDU - 7 bits
+ */
+ UINT8 nid;
+
+ /** Network Control - 1 bit */
+ UINT8 ctl;
+
+ /** Time To Live - 7 bits */
+ UINT8 ttl;
+
+ /** 16 Bit Source Address */
+ MS_NET_ADDR saddr;
+
+ /** 16 Bit Destination Address */
+ MS_NET_ADDR daddr;
+
+ /** 24 bit sequence number - currently filled only in recption path */
+ UINT32 seq_num;
+
+} MS_NET_HEADER;
+
+/** Data structures for filter type and address list */
+typedef UCHAR PROXY_FILTER_TYPE;
+
+/** Proxy Address */
+typedef MS_NET_ADDR PROXY_ADDR;
+
+/** Network Interface Handle */
+typedef UINT8 NETIF_HANDLE;
+
+/** Current Sequence Number and Block State */
+typedef struct _NET_SEQ_NUMBER_STATE
+{
+ /** Current Sequence Number */
+ UINT32 seq_num;
+
+ /** Block Sequence number - maximum available */
+ UINT32 block_seq_num_max;
+
+} NET_SEQ_NUMBER_STATE;
+
+/** \} */
+
+/** \} */
+
+/**
+ \defgroup net_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+/**
+ NETWORK Application Asynchronous Notification Callback.
+
+ NETWORK calls the registered callback to indicate events occurred to the
+ application.
+
+ \param brr_type Bearer Type.
+ \param net_hdr Network Header.
+ \param subnet_handle Associated Subnet Handle.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+
+ \return
+ - \ref NET_POST_PROCESS_RX_PKT: To inform Network Layer if the packet to be
+ further processed, e.g. to be relayed or proxied etc.
+
+ - Any Other Result/Error Code defined in MS_error.h: Ignored by Network Layer.
+*/
+typedef API_RESULT (*NET_NTF_CB)
+(
+ MS_NET_HEADER* net_hdr,
+ MS_SUBNET_HANDLE subnet_handle,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+
+/**
+ Network Proxy Application Asynchronous Notification Callback.
+
+ NETWORK PROXY calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Network Interface Handle.
+ \param p_evt Proxy Event.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef void (*PROXY_NTF_CB)
+(
+ NETIF_HANDLE* handle,
+ UCHAR p_evt,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup net_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Network Layer APIs.
+*/
+
+/**
+ Macro to check if Unicast Address
+*/
+#define MS_IS_UNICAST_ADDR(addr) \
+ (((MS_NET_ADDR_UNASSIGNED != (addr)) && \
+ (MS_NET_ADDR_UNICAST_COMPARE == ((addr) & MS_NET_ADDR_UNICAST_BIT_MASK))) \
+ ? MS_TRUE : MS_FALSE)
+
+/**
+ Macro to check if Virtual Address
+*/
+#define MS_IS_VIRTUAL_ADDR(addr) \
+ ((MS_NET_ADDR_VIRTUAL_COMPARE == ((addr) & MS_NET_ADDR_VIRTUAL_BIT_MASK)) \
+ ? MS_TRUE : MS_FALSE)
+
+/**
+ Macro to check if Group Address
+*/
+#define MS_IS_GROUP_ADDR(addr) \
+ ((MS_NET_ADDR_GROUP_COMPARE == ((addr) & MS_NET_ADDR_GROUP_BIT_MASK)) \
+ ? MS_TRUE : MS_FALSE)
+
+/**
+ Source address shall be Unicast Address.
+*/
+#define NET_IS_VALID_SRC_ADDR(addr) \
+ MS_IS_UNICAST_ADDR(addr)
+
+/**
+ Destination address
+ - Shall not be Unassigned Address.
+ - Control Message shall not be a Virtual Address.
+*/
+#define NET_IS_VALID_DST_ADDR(addr, ctl) \
+ (((MS_NET_ADDR_UNASSIGNED != (addr)) && \
+ ((0x01 != (ctl)) || (MS_FALSE == MS_IS_VIRTUAL_ADDR(addr)))) \
+ ? MS_TRUE : MS_FALSE)
+
+#ifdef MS_PROXY_CLIENT
+/* GATT Proxy Client Related defines */
+/**
+ \brief Set Proxy WhiteList Filter.
+
+ \par Description This function is used by the Proxy Client
+ to set the filter type on the Proxy Server to \ref MS_PROXY_WHITELIST_FILTER.
+
+ \param [in] nh Network Interface Handle
+ \param [in] sh Subnet Handle
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_proxy_set_whitelist_filter(nh,sh) \
+ MS_proxy_set_filter \
+ ( \
+ (nh), \
+ (sh), \
+ MS_PROXY_WHITELIST_FILTER \
+ );
+
+/**
+ \brief Set Proxy BlackList Filter.
+
+ \par Description This function is used by the Proxy Client
+ to set the filter type on the Proxy Server to \ref MS_PROXY_BLACKLIST_FILTER.
+
+ \param [in] nh Network Interface Handle
+ \param [in] sh Subnet Handle
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_proxy_set_blacklist_filter(nh,sh) \
+ MS_proxy_set_filter \
+ ( \
+ (nh), \
+ (sh), \
+ MS_PROXY_BLACKLIST_FILTER \
+ );
+
+/**
+ \brief Add addressess to Proxy Filter List.
+
+ \par Description This function is used by the Proxy Client
+ to add Addressess to the Proxy Server's filter List.
+
+ \param [in] nh Network Interface Handle
+ \param [in] sh Subnet Handle
+ \param [in] a Pointer to List of Address to be added
+ \param [in] c Count of Addressess present in the provided List
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_proxy_add_to_list(nh,sh,a,c) \
+ MS_proxy_filter_op \
+ ( \
+ (nh), \
+ (sh), \
+ MS_PROXY_ADD_TO_FILTER_OPCODE, \
+ (a), \
+ (c) \
+ );
+
+/**
+ \brief Delete addresses from Proxy Filter List.
+
+ \par Description This function is used by the Proxy Client
+ to delete/remove Addresses from the Proxy Server's filter List.
+
+ \param [in] nh Network Interface Handle
+ \param [in] sh Subnet Handle
+ \param [in] a Pointer to List of Address to be deleted/removed
+ \param [in] c Count of Addressess present in the provided List
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_proxy_del_from_list(nh,sh,a,c) \
+ MS_proxy_filter_op \
+ ( \
+ (nh), \
+ (sh), \
+ MS_PROXY_REM_FROM_FILTER_OPCODE, \
+ (a), \
+ (c) \
+ );
+#endif /* MS_PROXY_CLIENT */
+
+/* --------------------------------------------- Function */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ \brief Register Inerface with NETWORK Layer
+
+ \par Description
+ This routine registers interface with the NETWORK Layer.
+ NETWORK Layer supports only one upper layer, hence this routine shall be called once.
+
+ \param [in] net_cb
+ Upper Layer Notification Callback
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_net_register
+(
+ /* IN */ NET_NTF_CB net_cb
+);
+
+/**
+ \brief API to send Secure Network Beacon
+
+ \par Description
+ This routine sends Secure Network Beacon for the
+ given subnet handle
+
+ \param [in] subnet_handle
+ Subnet handle of the network to be broadcasted.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_net_broadcast_secure_beacon
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle
+);
+
+/**
+ \brief API to send NETWORK PDUs
+
+ \par Description
+ This routine sends NETWORK PDUs to peer device.
+
+ \param [in] hdr
+ Network Header
+
+ \param [in] subnet_handle
+ Subnet Handle
+
+ \param [in] buffer
+ Lower Transport Payload
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_net_send_pdu
+(
+ /* IN */ MS_NET_HEADER* hdr,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ MS_BUFFER* buffer,
+ /* IN */ UINT8 is_seg
+);
+
+/**
+ \brief To get address type.
+
+ \par Description
+ This routine is to get address type for a given address.
+
+ \param [in] addr Input Network Address
+
+ \return One of the following address type
+ \ref MS_NET_ADDR_TYPE_INVALID
+ \ref MS_NET_ADDR_TYPE_UNICAST
+ \ref MS_NET_ADDR_TYPE_VIRTUAL
+ \ref MS_NET_ADDR_TYPE_GROUP
+*/
+MS_NET_ADDR_TYPE MS_net_get_address_type
+(
+ /* IN */ MS_NET_ADDR addr
+);
+
+/**
+ \brief Register Interface with NETWORK PROXY Layer
+
+ \par Description
+ This routine registers interface with the NETWORK PROXY Layer.
+ NETWORK PROXY Layer supports only one upper layer, hence this rouine shall be called once.
+
+ \param [in] proxy_cb
+ Upper Layer Notification Callback
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_proxy_register
+(
+ /* IN */ PROXY_NTF_CB proxy_cb
+);
+
+/**
+ \brief Check if the Proxy Module is ready to handle Proxy Messages/Events
+
+ \par Description
+ This routine returns the current state of the Proxy. The valid states of
+ proxy are:
+ 1. MS_PROXY_NULL - If no callback registered by Upper Layers
+ 2. MS_PROXY_READY - If callback registered and Proxy not connected
+ 3. MS_PROXY_CONNECTED - if callback registered and Proxy connected
+
+ \param [out] proxy_state returns the current state of the Proxy
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_proxy_fetch_state (UCHAR* proxy_state);
+
+#ifdef MS_PROXY_CLIENT
+/**
+ \cond ignore_this Ignore this block while generating doxygen document
+*/
+/**
+ \brief Set Proxy Server's Filter Type.
+
+ \par Description This function is used by the Proxy Client
+ to set the filter type on the Proxy Server.
+
+ \param [in] handle Network Interface Handle
+ \param [in] subnet_handle Subnet Handle
+ \param [in] type Type of the Proxy Filter to be set. Either
+ \ref MS_PROXY_WHITELIST_FILTER or
+ \ref MS_PROXY_BLACKLIST_FILTER
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_proxy_set_filter
+(
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ PROXY_FILTER_TYPE type
+);
+
+/**
+ \brief Add or Delete/Remove addresses to/from Proxy Filter List.
+
+ \par Description This function is used by the Proxy Client
+ to add/delete Addresses to/from the Proxy Server's filter List.
+
+ \param [in] handle Network Interface Handle
+ \param [in] subnet_handle Subnet Handle
+ \param [in] opcode Operation to be performed. Either
+ \ref MS_PROXY_ADD_TO_FILTER_OPCODE or
+ \ref MS_PROXY_REM_FROM_FILTER_OPCODE
+ \param [in] addr Pointer to List of Address to be added/deleted
+ \param [in] addr_count Count of Addresses present in the provided List
+
+ \note This API will be used by the Proxy Client only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_proxy_filter_op
+(
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UCHAR opcode,
+ /* IN */ PROXY_ADDR* addr,
+ /* IN */ UINT16 addr_count
+);
+/**
+ \endcond
+*/
+#endif /* MS_PROXY_CLIENT */
+
+/* Function to Start ADV using Proxy */
+#ifdef MS_PROXY_SERVER
+/**
+ \brief Start Connectable Advertisements for a Proxy Server.
+
+ \par Description This function is used by the Proxy Server
+ to start Connectable Undirected Advertisements.
+
+ \param [in] subnet_handle Subnet Handle which the Proxy Server is
+ part of.
+ \param [in] proxy_adv_mode Mode of Proxy Advertisements. This could
+ be of two types
+ \ref MS_PROXY_NET_ID_ADV_MODE or
+ \ref MS_PROXY_NODE_ID_ADV_MODE
+
+ \note This API will be used by the Proxy Server only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_proxy_server_adv_start
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UCHAR proxy_adv_mode
+);
+
+API_RESULT MS_proxy_server_stop_timer(void);
+
+
+/**
+ \brief Stop Connectable Advertisements for a Proxy Server.
+
+ \par Description This function is used by the Proxy Server
+ to stop Connectable Undirected Advertisements.
+
+ \note This API will be used by the Proxy Server only.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_proxy_server_adv_stop (void);
+#endif /* MS_PROXY_SERVER */
+
+/**
+ \brief To allocate Sequence Number.
+
+ \par Description This function is used to allocate
+ Sequence Number.
+
+ \param [out] seq_num Location where SeqNum to be filled.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_net_alloc_seq_num(/* OUT */ UINT32* seq_num);
+
+API_RESULT MS_net_start_iv_update_timer(UINT8 timer_flag,UINT8 reset_en);
+
+void MS_net_stop_iv_update_timer(void);
+
+/**
+ \brief To get current Sequence Number state.
+
+ \par Description This function is used to get current
+ Sequence Number state.
+
+ \param [out] seq_num_state Location where Seq Number state to be filled.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_net_get_seq_num_state(/* OUT */ NET_SEQ_NUMBER_STATE* seq_num_state);
+
+/**
+ \brief To set current Sequence Number state.
+
+ \par Description This function is used to set current
+ Sequence Number state.
+
+ \param [in] seq_num_state Location from where Seq Number state to be taken.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_net_set_seq_num_state(/* IN */ NET_SEQ_NUMBER_STATE* seq_num_state);
+
+/* Start Secure Network Beacon Timer */
+void MS_net_start_snb_timer
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle
+);
+
+/* Stop Timer */
+void MS_net_stop_snb_timer
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle
+);
+
+void MS_net_iv_update_rcv_pro
+(
+ /* IN */ UINT32 iv_index,
+ /* IN */ UINT8 iv_update_flag
+);
+
+void MS_net_key_refresh
+(
+ /* IN */ MS_NET_ADDR* key_refresh_whitelist,
+ /* IN */ UINT16 num,
+ /* IN */ UINT8* new_net_key
+);
+
+
+/* Start Secure Network Beacon Timer */
+void MS_net_start_key_refresh_timer
+(
+ /* IN */ UINT16 context,
+ /* IN */ UINT32 time
+);
+
+/* Stop Key refresh Timer */
+void MS_net_stop_key_refresh_timer
+(
+ void
+);
+
+
+void MS_net_key_refresh_init(void);
+
+
+
+
+#ifdef __cplusplus
+};
+#endif
+
+/** \} */
+
+/** \} */
+
+#endif /* _H_MS_NET_API_ */
+
diff --git a/src/components/ethermind/mesh/export/include/MS_prov_api.h b/src/components/ethermind/mesh/export/include/MS_prov_api.h
new file mode 100644
index 0000000..c72987f
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_prov_api.h
@@ -0,0 +1,815 @@
+
+/**
+ \file MS_prov_api.h
+
+ \brief This file defines the Mesh Provisioning Application Interface - includes
+ Data Structures and Methods.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_PROV_API_
+#define _H_MS_PROV_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+/* Bearer Layer */
+#include "MS_brr_api.h"
+
+/* --------------------------------------------- Global Definitions */
+
+/**
+ \defgroup prov_module PROVISIONING (Mesh Provisioning Layer)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Provisioning module to the Application and other upper
+ layers of the stack.
+*/
+
+/**
+ \defgroup prov_defines Defines
+ \{
+ Describes defines for the module.
+*/
+
+/**
+ \defgroup prov_constants Constants
+ \{
+ Describes Constants defined by the module.
+*/
+
+/** Provisiong Roles */
+#define PROV_ROLE_DEVICE 0x01
+#define PROV_ROLE_PROVISIONER 0x02
+
+/** Provisioning Bearer Types */
+#define PROV_BRR_ADV 0x01
+#define PROV_BRR_GATT 0x02
+
+/** Provisioning PDU Types */
+#define PROV_PDU_TYPE_INVITE 0x00
+#define PROV_PDU_TYPE_CAPAB 0x01
+#define PROV_PDU_TYPE_START 0x02
+#define PROV_PDU_TYPE_PUBKEY 0x03
+#define PROV_PDU_TYPE_INPUT_CMPLT 0x04
+#define PROV_PDU_TYPE_CONF 0x05
+#define PROV_PDU_TYPE_RAND 0x06
+#define PROV_PDU_TYPE_DATA 0x07
+#define PROV_PDU_TYPE_COMPLETE 0x08
+#define PROV_PDU_TYPE_FAILED 0x09
+
+/** Provisioning algorithm values */
+#define PROV_ALGO_EC_FIPS_P256 0x00
+
+/** Provisioning public key values */
+#define PROV_PUBKEY_NO_OOB 0x00
+#define PROV_PUBKEY_OOB 0x01
+
+/** Provisioning authentication method values */
+#define PROV_AUTH_OOB_NONE 0x00
+#define PROV_AUTH_OOB_STATIC 0x01
+#define PROV_AUTH_OOB_OUTPUT 0x02
+#define PROV_AUTH_OOB_INPUT 0x03
+
+/** Provisioning Output OOB action values */
+#define PROV_OOOB_ACTION_BLINK 0x00
+#define PROV_OOOB_ACTION_BEEP 0x01
+#define PROV_OOOB_ACTION_VIBRATE 0x02
+#define PROV_OOOB_ACTION_NUMERIC 0x03
+#define PROV_OOOB_ACTION_ALPHANUMERIC 0x04
+
+/** Provisioning Input OOB action values */
+#define PROV_IOOB_ACTION_PUSH 0x00
+#define PROV_IOOB_ACTION_TWIST 0x01
+#define PROV_IOOB_ACTION_NUMERIC 0x02
+#define PROV_IOOB_ACTION_ALPHANUMERIC 0x03
+
+/** Provisioning algorithm support masks */
+#define PROV_MASK_ALGO_EC_FIPS_P256 (1 << 0)
+
+/** Provisioning public key supported type masks */
+#define PROV_MASK_PUBKEY_OOBINFO (1 << 0)
+
+/** Provisioning static oob supported type masks */
+#define PROV_MASK_STATIC_OOBINFO (1 << 0)
+
+/** Output OOB actions supported masks */
+#define PROV_MASK_OOOB_ACTION_BLINK (1 << 0)
+#define PROV_MASK_OOOB_ACTION_BEEP (1 << 1)
+#define PROV_MASK_OOOB_ACTION_VIBRATE (1 << 2)
+#define PROV_MASK_OOOB_ACTION_NUMERIC (1 << 3)
+#define PROV_MASK_OOOB_ACTION_ALPHANUMERIC (1 << 4)
+
+/** Input OOB actions supported masks */
+#define PROV_MASK_IOOB_ACTION_PUSH (1 << 0)
+#define PROV_MASK_IOOB_ACTION_TWIST (1 << 1)
+#define PROV_MASK_IOOB_ACTION_NUMERIC (1 << 2)
+#define PROV_MASK_IOOB_ACTION_ALPHANUMERIC (1 << 3)
+
+/**
+ \defgroup prov_control Control Constants
+ \{
+ Control constants defined by the specification.
+*/
+
+/** Number of Fragments - Start of New Transaction */
+#define PROV_PCF_NUM_FRGMNTS 0x00
+
+/** Control Message */
+#define PROV_PCF_CTRL_MSG 0x01
+
+/** Fragment Index - Continuation of a transaction */
+#define PROV_PCF_CONTINU_FRGMNT 0x02
+
+/** Transport Specific Messaging (only used by PB ADV) */
+#define PROV_PCF_TX_SPECIFIC 0x03
+
+/** \} */
+
+/**
+ \defgroup prov_advtxopcodes ADV Transport Opcodes
+ \{
+ Specification defined transport Opcodes for PB-ADV bearer.
+*/
+
+/* Link Open Request */
+#define PROV_PB_ADV_OPEN_REQ 0x00
+
+/* Link Open Confirm */
+#define PROV_PB_ADV_OPEN_CNF 0x01
+
+/* Link Close Indication */
+#define PROV_PB_ADV_CLOSE_IND 0x02
+
+/** \} */
+
+/**
+ \defgroup prov_gatttxopcodes GATT Transport Opcodes
+ \{
+ Implementation specific transport Opcodes for PB-GATT bearer.
+*/
+
+/* Link Open Indication */
+#define PROV_PB_GATT_OPEN_IND 0xF1
+
+/* Link Close Indication */
+#define PROV_PB_GATT_CLOSE_IND 0xF0
+
+/** \} */
+
+/**
+ \defgroup prov_errorcode Error Codes
+ \{
+ Describes Error Codes defined by the specification.
+*/
+
+/** Provisioning Failure Error Codes */
+#define PROV_ERR_PROHIBITED 0x00
+#define PROV_ERR_INVALID_PDU 0x01
+#define PROV_ERR_INVALID_FORMAT 0x02
+#define PROV_ERR_UNEXPECTED_PDU 0x03
+#define PROV_ERR_CONFIRMATION_FAILED 0x04
+#define PROV_ERR_OUT_OF_RESOURCES 0x05
+#define PROV_ERR_DECRYPTION_FAILED 0x06
+#define PROV_ERR_UNEXPECTED_ERROR 0x07
+#define PROV_ERR_CANNOT_ASSIGN_ADDRESS 0x08
+
+/** Provisioning LinkClose Error codes */
+#define PROV_CLOSE_REASON_SUCCESS 0x00
+#define PROV_CLOSE_REASON_TIMEOUT 0x01
+#define PROV_CLOSE_REASON_FAIL 0x02
+/** \} */
+
+/** Provisioning array size requirements */
+#define PROV_KEY_NETKEY_SIZE 16
+#define PROV_OOB_VALUE_SIZE 16
+#define PROV_URI_HASH_SIZE 4
+
+/** Provisioning OOB type masks for ADV data */
+#define PROV_OOB_TYPE_OTHER (1 << 0)
+#define PROV_OOB_TYPE_URI (1 << 1)
+#define PROV_OOB_TYPE_2DMRC (1 << 2)
+#define PROV_OOB_TYPE_BARCODE (1 << 3)
+#define PROV_OOB_TYPE_NFC (1 << 4)
+#define PROV_OOB_TYPE_NUMBER (1 << 5)
+#define PROV_OOB_TYPE_STRING (1 << 6)
+#define PROV_OOB_TYPE_ONBOX (1 << 11)
+#define PROV_OOB_TYPE_INSIDEBOX (1 << 12)
+#define PROV_OOB_TYPE_ONPIECEOFPAPER (1 << 13)
+#define PROV_OOB_TYPE_INSIDEMANUAL (1 << 14)
+#define PROV_OOB_TYPE_ONDEVICE (1 << 15)
+
+/** Invalid Provisioning Handle */
+#define PROV_HANDLE_INVALID 0xFF
+
+/** \} */
+
+/**
+ \defgroup prov_events Events
+ \{
+ This section lists the Asynchronous Events notified to Application by the
+ Module.
+*/
+
+/**
+ This event indicates the availability of an unprovisioned device beacon,
+ with the following values as parameters in the
+ \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_UNPROVISIONED_BEACON.
+ \param [in] event_result \ref API_SUCCESS.
+ \param [in] event_data Pointer to the array with the UUID of the device.
+ \param [in] event_datalen MS_DEVICE_UUID_SIZE
+
+ \note This event is received by the Provisioner application. On reception of
+ this event, the application shall make use of the MS_prov_bind() to initiate
+ the provisioning procedure.
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_UNPROVISIONED_BEACON 0x01
+
+/**
+ This event indicates that the provisioning procedure capability exchange is
+ complete, with the following values as parameters in the
+ \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_PROVISIONING_SETUP.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data When local provisioner, this contains peer device
+ capabilities and when local device, this contains the attention timeout
+ value.
+ \param [in] event_datalen When local provisioner, sizeof(\ref
+ PROV_CAPABILITIES_S) and when local device, sizeof(UINT32).
+
+ \note When local provisioner, the appliation shall select the required
+ capability from the received capabilities and choose to start the procedure
+ by calling \ref MS_prov_start().
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_PROVISIONING_SETUP 0x02
+
+/**
+ This event indicates to the application the OOB random data that is to be
+ displayed on the UI via the \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_OOB_DISPLAY.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data Pointer to OOB information as in \ref PROV_OOB_TYPE_S.
+ \param [in] event_datalen sizeof (\ref PROV_OOB_TYPE_S).
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_OOB_DISPLAY 0x03
+
+/**
+ This event indicates to the application requesting for OOB random data that
+ is to be used in the procedure via the \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_OOB_ENTRY.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data \ref Pointer to OOB information as in \ref PROV_OOB_TYPE_S.
+ \param [in] event_datalen sizeof (\ref PROV_OOB_TYPE_S).
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_OOB_ENTRY 0x04
+
+/**
+ This event indicates to the application that the peer device has completed the
+ Input of OOB when this capability is negotiated via the
+ \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_DEVINPUT_COMPLETE.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data NULL.
+ \param [in] event_datalen 0.
+
+ \note This event is generated only for the provisioner application.
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_DEVINPUT_COMPLETE 0x05
+
+/**
+ This event indicates to the application requesting for Provisional data to be
+ sent to the peer device via the \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_PROVDATA_INFO_REQ.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data NULL.
+ \param [in] event_datalen 0.
+
+ \note This event is generated only for the provisioner application.
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_PROVDATA_INFO_REQ 0x06
+
+/**
+ This event indicates to the application the Provisional data received
+ from the Provisioner via the \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_PROVDATA_INFO.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data Pointer to the provisioning data \ref PROV_DATA_S.
+ \param [in] event_datalen sizeof(\ref PROV_DATA_S).
+
+ \note This event is generated only for the device application.
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_PROVDATA_INFO 0x07
+
+/**
+ This event indicates to the application that the provisioning procedure
+ is complete via the \ref PROV_UI_NOTIFY_CB callback.
+
+ \param [in] phandle Pointer to the Provisioning context handle
+ \param [in] event_type \ref PROV_EVT_PROVISIONING_COMPLETE.
+ \param [in] event_result \ref API_SUCCESS on successful procedure completion, else
+ an Error Code.
+ \param [in] event_data NULL.
+ \param [in] event_datalen 0.
+
+ \return \ref API_SUCCESS (always)
+*/
+#define PROV_EVT_PROVISIONING_COMPLETE 0x08
+
+/** \} */
+
+/** \} */
+
+/* --------------------------------------------- Structures/Data Types */
+
+/**
+ \addtogroup prov_defines Defines
+ \{
+*/
+
+/**
+ \defgroup prov_structures Structures
+ \{
+*/
+
+/** Role of the device */
+typedef UCHAR PROV_ROLE;
+
+/** Bearer for the provisioning session */
+typedef UCHAR PROV_BRR;
+
+/** Handle to reference the active provisioning context */
+typedef UCHAR PROV_HANDLE;
+
+/** Device Information used for Provisioning */
+typedef struct _PROV_DEVICE_S
+{
+ /**
+ Device UUID -
+ Used in unprovisioned device beacon and Provisioning Invite
+ */
+ UCHAR uuid[MS_DEVICE_UUID_SIZE];
+
+ /** OOB Information */
+ UINT16 oob;
+
+ /** URI if any, to be given in encoded form */
+ MS_BUFFER* uri;
+
+} PROV_DEVICE_S;
+
+/** OOB type for provisioning */
+typedef struct _PROV_OOB_TYPE_S
+{
+ /** OOB Action information */
+ UINT16 action;
+
+ /** OOB Size information */
+ UCHAR size;
+
+} PROV_OOB_TYPE_S;
+
+/** Device capabilities used for Provisioning */
+typedef struct _PROV_CAPABILITIES_S
+{
+ /** Number of Elements */
+ UCHAR num_elements;
+
+ /** Supported algorithms */
+ UINT16 supp_algorithms;
+
+ /** Public key type */
+ UCHAR supp_pubkey;
+
+ /** Static OOB type */
+ UCHAR supp_soob;
+
+ /** Output OOB information */
+ PROV_OOB_TYPE_S ooob;
+
+ /** Input OOB information */
+ PROV_OOB_TYPE_S ioob;
+
+} PROV_CAPABILITIES_S;
+
+/** Provisioning method information */
+typedef struct _PROV_METHOD_S
+{
+ /** Algorithm selected */
+ UCHAR algorithm;
+
+ /** Public key usage */
+ UCHAR pubkey;
+
+ /** Authentication type */
+ UCHAR auth;
+
+ /** OOB type */
+ PROV_OOB_TYPE_S oob;
+
+} PROV_METHOD_S;
+
+/** Data exchanged during Provisiong procedure */
+typedef struct _PROV_DATA_S
+{
+ /** NetKey */
+ UCHAR netkey[PROV_KEY_NETKEY_SIZE];
+
+ /** Index of the NetKey */
+ UINT16 keyid;
+
+ /**
+ Flags bitmask
+ bit 0: Key Refresh Flag.
+ 0: Not-In-Phase2
+ 1: In-Phase2
+ bit 1: IV Update Flag
+ 0: Normal operation
+ 1: IV Update active
+
+ bits 2-7: RFU
+ */
+ UCHAR flags;
+
+ /** Current value of the IV index */
+ UINT32 ivindex;
+
+ /** Unicast address of the primary element */
+ UINT16 uaddr;
+
+} PROV_DATA_S;
+
+/** \} */
+/** \} */
+
+/**
+ \defgroup prov_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Provisioning Application Asynchronous Notification Callback.
+
+ Provisioning calls the registered callback to indicate events occurred to the
+ application.
+
+ \param phandle Handle that identifies the provisioning context.
+ \param event_type Event type from any of the events in \ref prov_events.
+ \param event_result API_SUCCESS or any error code.
+ \param event_data Data associated with the event if any or NULL.
+ \param event_datalen Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* PROV_UI_NOTIFY_CB)
+(
+ PROV_HANDLE* phandle,
+ UCHAR event_type,
+ API_RESULT event_result,
+ void* event_data,
+ UINT16 event_datalen
+);
+
+/** \} */
+
+/* --------------------------------------------- Macros */
+/**
+ \defgroup prov_marcos Utility Macros
+ \{
+ Initialization and other Utility Macros offered by the module.
+*/
+
+/**
+ \brief Setup the Device for provisioning
+
+ \par Description This function configures the application as an Unprovisioned
+ device over Advertising channel bearer and sets it ready for provisioning.
+
+ \param [in] pdev Pointer to the device strcuture \ref PROV_DEVICE_S.
+ \param [in] tmo The setup timeout value
+ \param [out] phdl The handle to the context setup on successful allocation
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_setup_device_pbadv(pdev, tmo, phdl) \
+ MS_prov_setup (PROV_ROLE_DEVICE, PROV_BRR_ADV, (pdev), (tmo), (phdl))
+
+/**
+ \brief Setup the Provisioner for provisioning
+
+ \par Description This function configures the application as a Provisioner
+ over Advertising channel bearer and sets it ready for provisioning.
+
+ \param [in] tmo The setup timeout value
+ \param [out] phdl The handle to the context setup on successful allocation
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_setup_provisioner_pbadv(tmo, phdl) \
+ MS_prov_setup (PROV_ROLE_PROVISIONER, PROV_BRR_ADV, NULL, (tmo), (phdl))
+
+/**
+ \brief Setup the device for provisioning
+
+ \par Description This function configures the application as an Unprovisioned
+ device over GATT channel bearer and sets it ready for provisioning.
+
+ \param [in] pdev Pointer to the device strcuture \ref PROV_DEVICE_S.
+ \param [in] tmo The setup timeout value
+ \param [out] phdl The handle to the context setup on successful allocation
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_setup_device_pbgatt(pdev, tmo, phdl) \
+ MS_prov_setup (PROV_ROLE_DEVICE, PROV_BRR_GATT, (pdev), (tmo), (phdl))
+
+/**
+ \brief Setup the Provisioner for provisioning
+
+ \par Description This function configures the application as a Provisioner
+ over GATT channel bearer and sets it ready for provisioning.
+
+ \param [in] tmo The setup timeout value
+ \param [out] phdl The handle to the context setup on successful allocation
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_setup_provisioner_pbgatt(tmo, phdl) \
+ MS_prov_setup (PROV_ROLE_PROVISIONER, PROV_BRR_GATT, NULL, (tmo), (phdl))
+
+/**
+ \brief Start Provisioning on the select set of device capabilities.
+
+ \par Description This function is used by the provisioner application to start
+ the procedure using the selected set of capabilities of the unprovisioned
+ device.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] pmethod Pointer to the structure with selected method.
+
+ \note This API will be used by the provisioner only, in response to the
+ \ref PROV_EVT_PROVISIONING_SETUP event
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_start(phandle, pmethod) \
+ MS_prov_send_pdu ((phandle), PROV_PDU_TYPE_START, (pmethod), sizeof(PROV_METHOD_S))
+
+/**
+ \brief Input Authentication value from Device/Provisioner application.
+
+ \par Description This function is used to receive the Authval from the
+ application and use it for the algorithm. When the application is that of a
+ device, it also sends the input complete message to the provisioner in the
+ given context.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] pauth Authentication Value (UINT32 *) or (UCHAR *)
+ \param [in] size Size of pauth
+
+ \note This API will be used in response to the
+ \ref PROV_EVT_OOB_ENTRY event
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_input_authval(phandle, pauth, size) \
+ MS_prov_send_pdu ((phandle), PROV_PDU_TYPE_INPUT_CMPLT, (pauth), (size))
+
+/**
+ \brief Send provisioning data to the device.
+
+ \par Description This function is used by the provisioning application to send
+ the provisioning data to the device after authentication is complete.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] pdata Pointer to the Provisioning data structre as in \ref
+ PROV_DATA_S
+
+ \note This API will be used by the provisioner only, in response to the
+ \ref PROV_EVT_PROVDATA_INFO_REQ event
+
+ \return API_SUCCESS or Error Code on failure
+*/
+#define MS_prov_data(phandle, pdata) \
+ MS_prov_send_pdu ((phandle), PROV_PDU_TYPE_DATA, (pdata), sizeof (PROV_DATA_S))
+
+/** \} */
+
+/* --------------------------------------------- External Global Definitions */
+/** Global Provisioning Role */
+extern UCHAR prov_role;
+
+
+/* --------------------------------------------- API Declarations */
+
+/**
+ \defgroup prvsng_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Provisioning Layer APIs.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ \brief Register provisioning capabilities and callback
+
+ \par Description This function registers the provisioning capabilities of the
+ application along with the application callback to notify events during the
+ provisioning procedure.
+
+ \param [in] pcapab Pointer to the provisioning capabilities structure \ref PROV_CAPABILITIES_S
+ \param [in] cb Application callback function pointer
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_register
+(
+ /* IN */ PROV_CAPABILITIES_S* pcapab,
+ /* IN */ PROV_UI_NOTIFY_CB cb
+);
+
+API_RESULT MS_prov_stop_interleave_timer
+(
+ void
+);
+
+
+/**
+ \brief Setup the device for provisioning
+
+ \par Description This function configures the device to get in a provisionable
+ state by specifying the role, bearer and creating a context.
+
+ \param [in] role Provisioniong role to be setup - Device or Provisioner.
+ \param [in] bearer Provisioning bearer to be setup - PB-ADV or PB-GATT
+ \param [in] pdevice Pointer to the device strcuture \ref PROV_DEVICE_S
+ containing the UUID to be beaconed. This parameter is used only when the
+ role is PROV_ROLE_DEVICE and ignored otherwise.
+ \param [in] timeout The time period for which the setup shall be active.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_setup
+(
+ /* IN */ PROV_ROLE role,
+ /* IN */ PROV_BRR bearer,
+ /* IN */ PROV_DEVICE_S* pdevice,
+ /* IN */ UINT16 gatt_timeout,
+ /* IN */ UINT16 adv_timeout
+);
+
+/**
+ \brief Bind to the peer device for provisioning
+
+ \par Description This function establishes a provisioning link with the peer device
+ and exchanges the capabilities for provisioning.
+
+ \param [in] bearer Provisioning bearer on which to be bound - PB-ADV or PB-GATT
+ \param [in] pdevice Pointer to the device strcuture \ref PROV_DEVICE_S.
+ \param [in] attention The attention duration in seconds to be configured by the
+ device. This parameter is dont care if the role is PROV_ROLE_DEVICE.
+ \param [out] phandle The handle to the context setup on successful allocation.
+
+ \note This API is for use by the Provisioner application only upon
+ reception of an Unprovisioned Device Beacon.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_bind
+(
+ /* IN */ PROV_BRR bearer,
+ /* IN */ PROV_DEVICE_S* pdevice,
+ /* IN */ UCHAR attention,
+ /* OUT */ PROV_HANDLE* phandle
+);
+
+/**
+ \brief Send provisioning PDUs to the peer.
+
+ \par Description This function is used by the provisioning application to send
+ the provisioning PDUs to the peer device during the procedure.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] pdu Following PDU types are handled -
+ PROV_PDU_TYPE_START
+ PROV_PDU_TYPE_INPUT_CMPLT
+ PROV_PDU_TYPE_DATA
+ \param [in] pdata Pointer to the data corresponding to the above PDUs
+ \param [in] datalen Size of the pdata
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_send_pdu
+(
+ /* IN */ PROV_HANDLE* phandle,
+ /* IN */ UCHAR pdu,
+ /* IN */ void* pdata,
+ /* IN */ UINT16 datalen
+);
+
+/**
+ \brief Set the display authval.
+
+ \par Description This function shall be used by the provisioning application
+ to set the authval being displayed to the user on receiving \ref
+ PROV_EVT_OOB_DISPLAY event with the respective OOB Action and Size.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] pdata Pointer to the Authval (UINT32 *) or (UCHAR *)
+ \param [in] datalen Size of the pdata
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_set_authval
+(
+ /* IN */ PROV_HANDLE* phandle,
+ /* IN */ void* pdata,
+ /* IN */ UINT16 datalen
+);
+
+/**
+ \brief Abort the provisioning procedure
+
+ \par Description
+ This API can be used by the application to abort the ongoing provisioning
+ procedure. This routine closes the provisioning link with the reason as
+ specified.
+
+ \param [in] phandle Provisioning context to be used.
+ \param [in] reason Reason for termination.
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_abort
+(
+ PROV_HANDLE* phandle,
+ UCHAR reason
+);
+
+/**
+ \brief Utility API to fetch current ECDH Public Key to be used for
+ Provisioning
+
+ \par Description
+ This API can be used by the application to fetch the current ECDH P256
+ Public Key which is to be used for the Provisioning Procedure.
+
+ \param [out] public_key to a pointer of \ref UCHAR array of length
+ \ref PROV_PUBKEY_SIZE
+
+ \return API_SUCCESS or Error Code on failure
+*/
+API_RESULT MS_prov_get_local_public_key
+(
+ /* OUT */ UCHAR* public_key
+);
+
+#ifdef __cplusplus
+};
+#endif
+
+/** \} */
+
+/** \} */
+
+#endif /* _H_MS_PROV_API_ */
+
diff --git a/src/components/ethermind/mesh/export/include/MS_scene_api.h b/src/components/ethermind/mesh/export/include/MS_scene_api.h
new file mode 100644
index 0000000..d2211e6
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_scene_api.h
@@ -0,0 +1,480 @@
+/**
+ \file MS_scene_api.h
+
+ \brief This file defines the Mesh Scene Model Application Interface
+ - includes Data Structures and Methods for both Server and Client.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_SCENE_API_
+#define _H_MS_SCENE_API_
+
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_access_api.h"
+
+
+/* --------------------------------------------- Global Definitions */
+/**
+ \defgroup scene_module SCENE (Mesh Scene Model)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Scene Model (SCENE) module to the Application.
+*/
+
+/** Scene Event Types */
+/** Scene Event - Store */
+#define MS_SCENE_EVENT_STORE 0x01
+
+/** Scene Event - Delete */
+#define MS_SCENE_EVENT_DELETE 0x02
+
+/** Scene Event - Recall Start */
+#define MS_SCENE_EVENT_RECALL_START 0x03
+
+/** Scene Event - Recall Complete */
+#define MS_SCENE_EVENT_RECALL_COMPLETE 0x04
+
+/** Scene Event - Recall Immediate */
+#define MS_SCENE_EVENT_RECALL_IMMEDIATE 0x05
+
+/* --------------------------------------------- Data Types/ Structures */
+/**
+ \defgroup scene_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+
+/**
+ Scene Server application Asynchronous Notification Callback.
+
+ Scene Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param [in] ctx Context of the message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+
+ TODO: Update
+*/
+typedef void* (* MS_SCENE_SERVER_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT8 event_type,
+ void* event_param,
+ UINT16 event_length,
+ void* context
+) DECL_REENTRANT;
+
+/**
+ Scene Client application Asynchronous Notification Callback.
+
+ Scene Client calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param opcode Opcode.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef API_RESULT (* MS_SCENE_CLIENT_CB)
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT32 opcode,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+/** \} */
+
+/**
+ \defgroup scene_structures Structures
+ \{
+*/
+
+/**
+ Scene Recall message parameters.
+*/
+typedef struct MS_scene_recall_struct
+{
+ /** The number of the scene to be recalled. */
+ UINT16 scene_number;
+
+ /** Transaction Identifier */
+ UCHAR tid;
+
+ /**
+ Transition Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR transition_time;
+
+ /** Message execution delay in 5 milliseconds steps */
+ UCHAR delay;
+
+ /** Flag: To represent if optional Transaction time and Delay fields are valid */
+ UCHAR optional_fields_present;
+
+} MS_SCENE_RECALL_STRUCT;
+
+/**
+ Scene Status message parameters.
+*/
+typedef struct MS_scene_status_struct
+{
+ /** Status Code */
+ UCHAR status_code;
+
+ /** Scene Number of a current scene. */
+ UINT16 current_scene;
+
+ /** Scene Number of a target scene. (Optional) */
+ UINT16 target_scene;
+
+ /**
+ Remaining Time is a 1-octet value that consists of two fields:
+ - a 2-bit bit field representing the step resolution
+ - a 6-bit bit field representing the number of transition steps.
+
+ Field | Size (bits) | Description
+ ---------------------------|-------------|----------------
+ Transition Number of Steps | 6 | The number of Steps
+ Transition Step Resolution | 2 | The resolution of the Default Transition
+ | Number of Steps field
+ */
+ UCHAR remaining_time;
+
+ /** Flag: To represent if optional fields Target Scene and Remaining Time are valid */
+ UCHAR optional_fields_present;
+
+} MS_SCENE_STATUS_STRUCT;
+
+/**
+ Scene Register Status message parameters.
+*/
+typedef struct MS_scene_register_status_struct
+{
+ /** Status Code */
+ UCHAR status_code;
+
+ /** Scene Number of a current scene */
+ UINT16 current_scene;
+
+ /** A list of scenes stored within an element */
+ UCHAR* scenes;
+
+ /** Number of Scenes */
+ UINT16 scenes_len;
+
+} MS_SCENE_REGISTER_STATUS_STRUCT;
+
+/**
+ Scene Store message parameters.
+*/
+typedef struct MS_scene_struct
+{
+ /** The number of the scene to be stored. */
+ UINT16 scene_number;
+
+} MS_SCENE_STRUCT;
+
+/** \} */
+
+
+
+/* --------------------------------------------- Function */
+/**
+ \defgroup scene_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Scene Model APIs.
+*/
+/**
+ \defgroup scene_ser_api_defs Scene Server API Definitions
+ \{
+ This section describes the Scene Server APIs.
+*/
+
+/**
+ \brief API to initialize Scene Server model
+
+ \par Description
+ This is to initialize Scene Server model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] scene_model_handle
+ Model identifier associated with the Scene model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in, out] scene_setup_model_handle
+ Model identifier associated with the Scene Setup model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Scene Server.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_scene_server_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* scene_model_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* scene_setup_model_handle,
+ /* IN */ MS_SCENE_SERVER_CB appl_cb
+);
+
+/**
+ \brief API to send reply or to update state change
+
+ \par Description
+ This is to send reply for a request or to inform change in state.
+
+ \param [in] ctx Context of the message.
+ \param [in] current_state_params Model specific current state parameters.
+ \param [in] target_state_params Model specific target state parameters (NULL: to be ignored).
+ \param [in] remaining_time Time from current state to target state (0: to be ignored).
+ \param [in] ext_params Additional parameters (NULL: to be ignored).
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_scene_server_state_update
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* current_state_params,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* target_state_params,
+ /* IN */ UINT16 remaining_time,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+);
+/** \} */
+
+/**
+ \defgroup scene_cli_api_defs Scene Client API Definitions
+ \{
+ This section describes the Scene Client APIs.
+*/
+
+/**
+ \brief API to initialize Scene Client model
+
+ \par Description
+ This is to initialize Scene Client model and to register with Acess layer.
+
+ \param [in] element_handle
+ Element identifier to be associated with the model instance.
+
+ \param [in, out] model_handle
+ Model identifier associated with the model instance on successful initialization.
+ After power cycle of an already provisioned node, the model handle will have
+ valid value and the same will be reused for registration.
+
+ \param [in] appl_cb Application Callback to be used by the Scene Client.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_scene_client_init
+(
+ /* IN */ MS_ACCESS_ELEMENT_HANDLE element_handle,
+ /* INOUT */ MS_ACCESS_MODEL_HANDLE* model_handle,
+ /* IN */ MS_SCENE_CLIENT_CB appl_cb
+);
+
+/**
+ \brief API to get Scene client model handle
+
+ \par Description
+ This is to get the handle of Scene client model.
+
+ \param [out] model_handle Address of model handle to be filled/returned.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_scene_client_get_model_handle
+(
+ /* OUT */ MS_ACCESS_MODEL_HANDLE* model_handle
+);
+
+/**
+ \brief API to send acknowledged commands
+
+ \par Description
+ This is to initialize sending acknowledged commands.
+
+ \param [in] req_opcode Request Opcode.
+ \param [in] param Parameter associated with Request Opcode.
+ \param [in] rsp_opcode Response Opcode.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_scene_client_send_reliable_pdu
+(
+ /* IN */ UINT32 req_opcode,
+ /* IN */ void* param,
+ /* IN */ UINT32 rsp_opcode
+);
+
+/**
+ \brief API to get the current status of a currently active scene of an element.
+
+ \par Description
+ Scene Get is an acknowledged message used to get the current status of a currently active scene of an element.
+ The response to the Scene Get message is a Scene Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_get() \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_SCENE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to ecall the current state of an element.
+
+ \par Description
+ Scene Recall is an acknowledged message that is used to recall the current state of an element from a previously stored scene.
+ The response to the Scene Recall message is a Scene Status message.
+
+ \param [in] param Scene Recall message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_recall(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_RECALL_OPCODE,\
+ param,\
+ MS_ACCESS_SCENE_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to ecall the current state of an element.
+
+ \par Description
+ Scene Recall Unacknowledged is an unacknowledged message used to recall the current state of an element from a previously stored Scene.
+
+ \param [in] param Scene Recall message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_recall_unacknowledged(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_RECALL_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to get the current status of the Scene Register of an element.
+
+ \par Description
+ Scene Register Get is an acknowledged message used to get the current status of the Scene Register of an element.
+ The response to the Scene Register Get message is a Scene Register Status message.
+ There are no parameters for this message.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_register_get() \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_REGISTER_GET_OPCODE,\
+ NULL,\
+ MS_ACCESS_SCENE_REGISTER_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to store the current state of an element as a Scene.
+
+ \par Description
+ Scene Store is an acknowledged message used to store the current state of an element as a Scene, which can be recalled later.
+ The response to the Scene Store message is a Scene Register Status message.
+
+ \param [in] param Scene Store message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_store(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_STORE_OPCODE,\
+ param,\
+ MS_ACCESS_SCENE_REGISTER_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to store the current state of an element as a Scene.
+
+ \par Description
+ Scene Store Unacknowledged is an unacknowledged message used to store the current state of an element as a Scene, which can be recalled later.
+
+ \param [in] param Scene Store message
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_store_unacknowledged(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_STORE_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+
+/**
+ \brief API to delete a Scene from the Scene Register state of an element.
+
+ \par Description
+ Scene Delete is an acknowledged message used to delete a Scene from the Scene Register state of an element.
+ The response to the Scene Delete message is a Scene Register Status message.
+
+ \param [in] param Scene Delete parameter
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_delete(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_DELETE_OPCODE,\
+ param,\
+ MS_ACCESS_SCENE_REGISTER_STATUS_OPCODE\
+ )
+
+/**
+ \brief API to delete a Scene from the Scene Register state of an element.
+
+ \par Description
+ Scene Delete Unacknowledged is an unacknowledged message used to delete a scene from the Scene Register state of an element.
+
+ \param [in] param Scene Delete parameter
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_scene_delete_unacknowledged(param) \
+ MS_scene_client_send_reliable_pdu \
+ (\
+ MS_ACCESS_SCENE_DELETE_UNACKNOWLEDGED_OPCODE,\
+ param,\
+ 0xFFFFFFFF\
+ )
+/** \} */
+/** \} */
+/** \} */
+
+#endif /*_H_MS_SCENE_API_ */
diff --git a/src/components/ethermind/mesh/export/include/MS_trn_api.h b/src/components/ethermind/mesh/export/include/MS_trn_api.h
new file mode 100644
index 0000000..9437447
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_trn_api.h
@@ -0,0 +1,1031 @@
+
+/**
+ \file MS_trn_api.h
+
+ \brief This file defines the Mesh Transport Application Interface - includes
+ Data Structures and Methods.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_TRN_API_
+#define _H_MS_TRN_API_
+
+/* --------------------------------------------- Header File Inclusion */
+/* Lower Transport Layer */
+#include "MS_ltrn_api.h"
+
+extern void blebrr_scan_pl (UCHAR enable);
+
+
+
+/* --------------------------------------------- Global Definitions */
+
+/**
+ \defgroup trn_module TRANSPORT (Mesh Transport Layer)
+ \{
+ This section describes the interfaces & APIs offered by the EtherMind
+ Mesh Transport (TRANSPORT) module to the Application and other upper
+ layers of the stack.
+*/
+
+/**
+ \defgroup trn_defines Defines
+ \{
+ Describes defines for the module.
+*/
+
+/**
+ \defgroup trn_constants Constants
+ \{
+ Describes Constants defined by the module.
+*/
+
+/**
+ Tranport Layer Control Packet Opcodes
+
+ RFU: 0x02 - 0x0F
+*/
+
+/**
+ Sent by a Low Power node to its Friend node to request any messages
+ that it has cached for the Low Power node
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_POLL 0x01
+
+/**
+ Sent by a Friend node to a Low Power node to inform it about cache
+ and/or security updates
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_UPDATE 0x02
+
+/** Broadcast by a Low Power node to start to find a friend */
+#define MS_TRN_CTRL_OPCODE_FRND_REQ 0x03
+
+/** Sent by a Friend node to a Low Power node to offer to become its friend */
+#define MS_TRN_CTRL_OPCODE_FRND_OFFER 0x04
+
+/**
+ Sent to a Friend node to inform a previous friend of a Low Power node
+ about the removal of a friendship
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_CLEAR 0x05
+
+/**
+ Sent from a previous friend to Friend node to confirm that a prior friend
+ relationship has been removed
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_CLEAR_CNF 0x06
+
+/**
+ Sent to a Friend node to add one or more addresses
+ to the Friend Subscription List
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_ADD 0x07
+
+/**
+ Sent to a Friend node to remove one or more addresses
+ from the Friend Subscription List
+*/
+#define MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_REMOVE 0x08
+
+/** Sent by a Friend node to confirm Friend Subscription List updates */
+#define MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_CNF 0x09
+
+/** Sent by a node to let other nodes determine topology of a Subnet */
+#define MS_TRN_CTRL_OPCODE_HEARTBEAT 0x0A
+
+/**
+ Parameter defines for Friendship Opcodes
+*/
+/**
+ Friend Update Flags
+
+ Bit 0: Key Refresh Flag
+ 0: Not-In-Phase2
+ 1: In-Phase2
+
+ Bit 1: IV Update Flag
+ 0: Normal operation
+ 1: IV Update active
+*/
+#define MS_FRNDUPD_FLAG_KEYREF_BIT 0
+#define MS_FRNDUPD_FLAG_KEYREF_NOTINPHASE_2 0x00
+#define MS_FRNDUPD_FLAG_KEYREF_INPHASE_2 0x01
+
+#define MS_FRNDUPD_FLAG_IVUPDATE_BIT 1
+#define MS_FRNDUPD_FLAG_IVUPDATE_NORMAL 0x00
+#define MS_FRNDUPD_FLAG_IVUPDATE_ACTIVE 0x01
+
+/**
+ Friend Update More Data
+*/
+#define MS_FRNDUPD_MD_QUEUE_EMPTY 0x00
+#define MS_FRNDUPD_MD_QUEUE_NOTEMPTY 0x01
+
+/**
+ Friend Request Criteria
+*/
+#define MS_FRNDREQ_RSSIFACTOR_OFFSET 5
+#define MS_FRNDREQ_RSSIFACTOR_MASK 0x60
+#define MS_FRNDREQ_RSSIFACTOR_1 0x00
+#define MS_FRNDREQ_RSSIFACTOR_1_5 0x01
+#define MS_FRNDREQ_RSSIFACTOR_2 0x02
+#define MS_FRNDREQ_RSSIFACTOR_2_5 0x03
+
+#define MS_FRNDREQ_RCVWINFACTOR_OFFSET 3
+#define MS_FRNDREQ_RCVWINFACTOR_MASK 0x18
+#define MS_FRNDREQ_RCVWINFACTOR_1 0x00
+#define MS_FRNDREQ_RCVWINFACTOR_1_5 0x01
+#define MS_FRNDREQ_RCVWINFACTOR_2 0x02
+#define MS_FRNDREQ_RCVWINFACTOR_2_5 0x03
+
+#define MS_FRNDREQ_MINQSIZELOG_OFFSET 0
+#define MS_FRNDREQ_MINQSIZELOG_MASK 0x07
+#define MS_FRNDREQ_MINQSIZE_INVALID 0x00
+#define MS_FRNDREQ_MINQSIZE_2 0x01
+#define MS_FRNDREQ_MINQSIZE_4 0x02
+#define MS_FRNDREQ_MINQSIZE_8 0x03
+#define MS_FRNDREQ_MINQSIZE_16 0x04
+#define MS_FRNDREQ_MINQSIZE_32 0x05
+#define MS_FRNDREQ_MINQSIZE_64 0x06
+#define MS_FRNDREQ_MINQSIZE_128 0x07
+
+/**
+ Heartbeat features
+*/
+#define MS_HEARTBEAT_FEATURE_RELAY (1 << 0)
+#define MS_HEARTBEAT_FEATURE_PROXY (1 << 1)
+#define MS_HEARTBEAT_FEATURE_FRIEND (1 << 2)
+#define MS_HEARTBEAT_FEATURE_LOWPOWER (1 << 3)
+
+/** Friendship constants as defined in the specification */
+#define MS_MIN_FRNDOFFER_DELAY 100 /* ms */
+#define MS_TRN_INITIAL_FRNDPOLL_TIMEOUT 1000 /* ms */
+
+/** \} */
+
+/**
+ \defgroup trn_events Events
+ \{
+ This section lists the Asynchronous Events notified to Application by the
+ Module.
+*/
+#define MS_TRN_FRIEND_SETUP_CNF 0x00
+#define MS_TRN_FRIEND_SUBSCRNLIST_CNF 0x01
+#define MS_TRN_FRIEND_CLEAR_CNF 0x02
+#define MS_TRN_FRIEND_TERMINATE_IND 0x03
+
+/** \} */
+/** \} */
+
+/**
+ \defgroup trn_marcos Utility Macros
+ \{
+ Initialization and other Utility Macros offered by the module.
+*/
+
+/** \} */
+
+/* --------------------------------------------- Data Types/ Structures */
+
+/**
+ \addtogroup trn_defines Defines
+ \{
+*/
+
+/**
+ \addtogroup trn_structures Structures
+ \{
+*/
+
+/** \} */
+
+/** \} */
+
+typedef API_RESULT (*TRN_HEARTBEAT_RCV_CB)
+(
+ MS_NET_ADDR addr,
+ MS_SUBNET_HANDLE subnet_handle,
+ UINT8 countlog
+) DECL_REENTRANT;
+
+typedef API_RESULT (*TRN_HEARTBEAT_RCV_TIMEOUT_CB)
+(
+ void
+) DECL_REENTRANT;
+
+
+
+/**
+ \defgroup trn_cb Application Callback
+ \{
+ This Section Describes the module Notification Callback interface offered
+ to the application
+*/
+/**
+ TRANSPORT Application Asynchronous Notification Callback.
+
+ TRANSPORT calls the registered callback to indicate events occurred to the
+ application.
+
+ \param brr_type Bearer Type.
+ \param net_hdr Network Header.
+ \param subnet_handle Associated Subnet Handle.
+ \param appkey_handle Associated AppKey Handle.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+typedef void (*TRN_NTF_CB)
+(
+ MS_NET_HEADER* net_hdr,
+ MS_SUBNET_HANDLE subnet_handle,
+ MS_APPKEY_HANDLE appkey_handle,
+ UCHAR* data_param,
+ UINT16 data_len
+) DECL_REENTRANT;
+
+/**
+ TRANSPORT Application Friendship Asynchronous Notification Callback.
+
+ TRANSPORT calls the registered callback to indicate the status of froednship
+ setup procedure to the application
+
+ \param subnet_handle Associated Subnet Handle.
+ \param event_type Friendship event. \ref trn_events
+ \param status Result of the procedure.
+*/
+typedef void (*TRN_FRND_CB)
+(
+ MS_SUBNET_HANDLE subnet_handle,
+ UCHAR event_type,
+ UINT16 status
+) DECL_REENTRANT;
+
+/** \} */
+
+/**
+ \addtogroup trn_defines Defines
+ \{
+*/
+
+/**
+ \addtogroup trn_structures Structures
+ \{
+*/
+/** Transport Control Packet Opcode Type */
+typedef UCHAR MS_TRN_CTRL_PKT_OPCODE;
+
+/** Friend Data Structure */
+typedef struct _MS_TRN_FRIEND_ENTRY
+{
+ /** Friend Seqnece Number - 7 bit value */
+ UINT8 fsn;
+
+ /** Low Power Node Address */
+ MS_NET_ADDR addr;
+
+ /** Number of Elements in LPN */
+ UINT8 num_elements;
+
+ /** Previous Friend Address */
+ MS_NET_ADDR prev_faddr;
+
+ /** Friend Queue */
+ /* UINT32 q; */
+
+ /** Subscription List of LPN */
+ /* UINT32 subscription_list; */
+
+} MS_TRN_FRIEND_ENTRY;
+
+/** Transport Friend Poll Message */
+typedef struct _MS_TRN_FRND_POLL_PARAM
+{
+ /**
+ Friend Sequence Number used to acknowledge receipt of
+ previous messages from the Friend node to the Low Power node.
+ */
+ UINT8 fsn;
+
+} MS_TRN_FRND_POLL_PARAM;
+
+/** Transport Friend Update Message */
+typedef struct _MS_TRN_FRND_UPDATE_PARAM
+{
+ /** Contains the IV Update Flag and the Key Refresh Flag */
+ UINT8 flags;
+
+ /** The current IV Index value known by the Friend node */
+ UINT32 ivi;
+
+ /**
+ Availability of data in friend queue
+
+ Value | Description
+ ------|------------
+ 0 | Friend Queue is empty
+ 1 | Friend Queue is not empty
+ */
+ UCHAR md;
+
+} MS_TRN_FRND_UPDATE_PARAM;
+
+/** Transport Friend Request Message */
+typedef struct _MS_TRN_FRND_REQ_PARAM
+{
+ /**
+ The criteria that a Friend node should support
+ in order to participate in friendship negotiation
+ */
+ UCHAR criteria;
+
+ /** Receive delay requested by the Low Power node */
+ UCHAR rx_delay;
+
+ /** Poll timeout requested by the Low Power node */
+ UINT32 poll_to;
+
+ /** Previous Friend's unicast address */
+ UINT16 prev_addr;
+
+ /** Number of Elements in the Low Power node */
+ UCHAR num_elem;
+
+ /** Number of Friend Request messages that the Low Power node has sent */
+ UINT16 lpn_counter;
+
+} MS_TRN_FRND_REQ_PARAM;
+
+/** Transport Friend Offer Message */
+typedef struct _MS_TRN_FRND_OFFER_PARAM
+{
+ /** Receive Window value supported by the Friend node */
+ UINT8 rx_window;
+
+ /** Queue Size available on the Friend node */
+ UINT8 queue_size;
+
+ /**
+ Size of the Subscription List that can be supported
+ by a Friend node for a Low Power node
+ */
+ UINT8 sublist_size;
+
+ /** RSSI measured by the Friend node */
+ UINT8 rssi;
+
+ /** Number of Friend Offer messages that the Friend node has sent */
+ UINT16 frnd_counter;
+
+} MS_TRN_FRND_OFFER_PARAM;
+
+/** Transport Friend Clear Message */
+typedef struct _MS_TRN_FRND_CLEAR_PARAM
+{
+ /** The unicast address of the Low Power node being removed */
+ UINT16 lpn_addr;
+
+ /** Value of the LPNCounter of new relationship */
+ UINT16 lpn_counter;
+
+} MS_TRN_FRND_CLEAR_PARAM;
+
+/** Transport Friend Clear Confirm Message */
+typedef struct _MS_TRN_FRND_CLEAR_CNF_PARAM
+{
+ /** The unicast address of the Low Power node being removed */
+ UINT16 lpn_addr;
+
+ /** Value of the LPNCounter of corresponding Friend Clear message */
+ UINT16 lpn_counter;
+
+} MS_TRN_FRND_CLEAR_CNF_PARAM;
+
+/** Transport Friend Subscription List Add/Remove Message */
+typedef struct _MS_TRN_FRND_MANAGE_PARAM
+{
+ /** The number for identifying a transaction */
+ UINT8 txn_num;
+
+ /**
+ List of group addresses and virtual addresses where N is
+ the number of group addresses and virtual addresses in this message.
+
+ Address octet stream packed in big-endian format.
+ */
+ void* addr_list;
+
+ /**
+ Number of Addresses in the list
+
+ Note: Number of addresses is half of the octets in the addr_list field.
+ */
+ UINT16 num_addr;
+
+ /** Opcode - Add/Delete */
+ UINT8 opcode;
+
+} MS_TRN_FRND_MANAGE_PARAM;
+
+/** Transport Friend Subscription List Confirm Message */
+typedef struct _MS_TRN_FRND_SUBSCRN_LIST_CNF_PARAM
+{
+ /** The number for identifying a transaction */
+ UINT8 txn_num;
+
+} MS_TRN_FRND_SUBSCRN_LIST_CNF_PARAM;
+
+/** Transport Heartbeat Message */
+typedef struct _MS_TRN_HEARTBEAT_PARAM
+{
+ /** Initial TTL used when sending the message */
+ UINT8 init_ttl;
+
+ /** Bit field of currently active features of the node */
+ UINT16 features;
+
+} MS_TRN_HEARTBEAT_PARAM;
+
+/** Low Power Node element information */
+typedef struct _MS_TRN_FRNDSHIP_INFO
+{
+ /* Main subnet handle of the element */
+ MS_SUBNET_HANDLE subnet_handle;
+
+ /* Peer LPN/Friend Address */
+ MS_NET_ADDR addr;
+
+ /* Low Power Node Counter */
+ UINT16 lpn_counter;
+
+ /* Friend Counter - TODO: Should be a global index? */
+ UINT16 frnd_counter;
+
+} MS_TRN_FRNDSHIP_INFO;
+
+/* Invalid LPN Handle */
+#define LPN_HANDLE_INVALID MS_CONFIG_LIMITS(MS_MAX_LPNS)
+
+/** Hearbeat Publication state */
+typedef struct _MS_TRN_HEARTBEAT_PUBLICATION_INFO
+{
+ /**
+ Destination address for Heartbeat messages
+ */
+ MS_NET_ADDR daddr;
+
+ /**
+ Count to control the number of periodic heartbeat
+ transport messages to be sent
+ */
+ UINT8 count_log;
+
+ /**
+ Period to control the cadence of periodic heartbeat
+ transport messages
+ */
+ UINT8 period_log;
+
+ /**
+ TTL value to be used when sending Heartbeat messages
+ */
+ UINT8 ttl;
+
+ /**
+ Features that trigger sending Heartbeat messages when changed
+ */
+ UINT16 features;
+
+ /**
+ Global NetKey index of the NetKey to be used to send Heartbeat messges
+ */
+ UINT16 netkey_index;
+
+} MS_TRN_HEARTBEAT_PUBLICATION_INFO;
+
+/** Hearbeat Subscription state */
+typedef struct _MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO
+{
+ /**
+ Source address for Heartbeat messages that a node shall process
+ */
+ MS_NET_ADDR saddr;
+
+ /**
+ Destination address for Heartbeat messages
+ */
+ MS_NET_ADDR daddr;
+
+ /**
+ Counter that tracks the number of periodic heartbeat transport message
+ received since receiving the most recent Config Heartbeat Subscription
+ Set message
+ */
+ UINT8 count_log;
+
+ /**
+ Period that controls the period for processing periodical Heartbeat
+ transport control messages
+ */
+ UINT8 period_log;
+
+ /**
+ Minimum hops value registered when receiving heartbeat messages since
+ receiving the most recent Config Heartbeat Subscription Set message
+ */
+ UINT16 min_hops;
+
+ /**
+ Maximum hops value registered when receiving heartbeat messages since
+ receiving the most recent Config Heartbeat Subscription Set message
+ */
+ UINT16 max_hops;
+
+} MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO;
+
+/** \} */
+
+/** \} */
+
+/** TCF (Transport Control Field) - Transport Field Value */
+
+
+/* --------------------------------------------- Function */
+
+/**
+ \defgroup trn_api_defs API Definitions
+ \{
+ This section describes the EtherMind Mesh Transport Layer APIs.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ \brief Register Inerface with Transport Layer
+
+ \par Description
+ This routine registers interface with the Transport Layer.
+ Transport Layer supports single Application, hence this rouine shall be called once.
+
+ \param [in] trn_cb
+ Upper Layer Notification Callback for specific message type
+
+ \param [in] msg_type
+ Message type (Control or Access) for which the callback to be called.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_register
+(
+ /* IN */ TRN_NTF_CB trn_cb,
+ /* IN */ MS_TRN_MSG_TYPE msg_type
+);
+
+API_RESULT MS_trn_heartbeat_register
+(
+ /* IN */ TRN_HEARTBEAT_RCV_CB rcv_cb,
+ /* IN */ TRN_HEARTBEAT_RCV_TIMEOUT_CB rcv_to_cb
+);
+
+
+
+/**
+ \brief API to send Access Layer PDUs
+
+ \par Description
+ This routine sends Access Layer PDUs to peer device.
+
+ \param [in] src_addr
+ Source Address
+
+ \param [in] dst_addr
+ Destination Address
+
+ \param [in] label
+ Lable UUID, represending Virtual Address of Destination
+
+ \param [in] subnet_handle
+ Handle identifying the Subnet
+
+ \param [in] appkey_handle
+ Handle identifying the AppKey to be used for Transport Layer encryption.
+
+ \param [in] ttl
+ Time to Live
+
+ \param [in] param
+ Transport parameter, based on the type and header
+
+ \param [in] reliable
+ If requires lower transport Ack, set reliable as TRUE
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_send_access_pdu
+(
+ /* IN */ MS_NET_ADDR src_addr,
+ /* IN */ MS_NET_ADDR dst_addr,
+ /* IN */ UINT8* label,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ MS_APPKEY_HANDLE appkey_handle,
+ /* IN */ UINT8 ttl,
+ /* IN */ void* param,
+ /* IN */ UINT8 reliable
+);
+
+/**
+ \brief API to send transport Control PDUs
+
+ \par Description
+ This routine sends transport Control PDUs to peer device.
+
+ \param [in] src_addr
+ Source Address
+
+ \param [in] dst_addr
+ Destination Address
+
+ \param [in] subnet_handle
+ Handle identifying the Subnet
+
+ \param [in] ttl
+ Time to Live
+
+ \param [in] ctrl_opcode
+ Control Packet Opcode.
+
+ \param [in] param
+ Transport parameter, based on the type and header
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_send_control_pdu
+(
+ /* IN */ MS_NET_ADDR src_addr,
+ /* IN */ MS_NET_ADDR dst_addr,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UINT8 ttl,
+ /* IN */ MS_TRN_CTRL_PKT_OPCODE ctrl_opcode,
+ /* IN */ void* param
+);
+
+
+/**
+ \brief API to setup Friendship.
+
+ \par Description
+ This routine is used by the device acting as a low power node
+ to setup a friendship procedure to any available friend nodes.
+
+ \param [in] subnet_handle
+ The subnet to initiate the friendship procedure.
+
+ \param [in] criteria
+ Friend criteria that is required. RSSI, Receive Window,
+ MessageQueue size requirements can be established.
+
+ \param [in] rx_delay
+ Receive delay in milliseconds that the LPN will wait before
+ listening to response for any request.
+
+ \param [in] poll_timeout
+ Timeout in milliseconds after which the LPN will send Poll PDU
+ to check for data from the friend.
+
+ \param [in] setup_timeout
+ Timeout in milliseconds for which the Friend Establishment
+ procedure is to be tried.
+
+ \param [in] cb
+ Application Callback to notify the result of friendship procedures.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_lpn_setup_friendship
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UCHAR criteria,
+ /* IN */ UCHAR rx_delay,
+ /* IN */ UINT32 poll_timeout,
+ /* IN */ UINT32 setup_timeout,
+ /* IN */ TRN_FRND_CB cb
+);
+
+
+/**
+ \brief API to terminate friendship.
+
+ \par Description
+ This routine is used by the device acting as a low power node
+ terminate friendship with an active Friend node.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_lpn_clear_friendship(void);
+
+
+/**
+ \brief API to manage friend subscription list.
+
+ \par Description
+ This routine is used by the device acting as a low power node
+ add/remove addresses to/from the friends subscription list.
+
+ \param [in] action
+ Will be one of MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_ADD or
+ MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_REMOVE
+
+ \param [in] addr_list
+ Pointer to the packed list of addresses to be managed.
+
+ \param [in] count
+ Number of addresses given.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_lpn_manage_subscription
+(
+ UCHAR action,
+ UINT16* addr_list,
+ UINT16 count
+);
+
+
+/**
+ \brief API to add to friend subscription list.
+
+ \par Description
+ This routine is used by the device acting as a low power node
+ add addresses to the friends subscription list.
+
+ \param [in] addr_list
+ Pointer to the list of addresses to be managed.
+
+ \param [in] count
+ Number of addresses given.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_trn_lpn_subscrn_list_add(addr_list, count)\
+ MS_trn_lpn_manage_subscription\
+ (\
+ MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_ADD,\
+ (addr_list),\
+ (count)\
+ );
+
+
+/**
+ \brief API to remove from friend subscription list.
+
+ \par Description
+ This routine is used by the device acting as a low power node
+ remove addresses from the friends subscription list.
+
+ \param [in] addr_list
+ Pointer to the list of addresses to be managed.
+
+ \param [in] count
+ Number of addresses given.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+#define MS_trn_lpn_subscrn_list_remove(addr_list, count)\
+ MS_trn_lpn_manage_subscription\
+ (\
+ MS_TRN_CTRL_OPCODE_FRND_SUBSCRN_LIST_REMOVE,\
+ (addr_list),\
+ (count)\
+ );
+
+/**
+ \brief To check if address matches with any of the LPN
+
+ \par Description
+ This routine checks if destination address in a received packet matches
+ with any of the known element address of LPN.
+
+ \param [in] addr Unicast Address to search
+ \param [out] lpn_handle LPN Handle on match
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_is_valid_lpn_element_address
+(
+ /* IN */ MS_NET_ADDR addr,
+ /* OUT */ LPN_HANDLE* lpn_handle
+);
+
+/**
+ \brief To check if valid subscription address of an LPN to receive a packet
+
+ \par Description
+ This routine checks if destination address in a received packet matches
+ with any of the known subscription address of an LPN.
+
+ \param [in] addr Address to search
+ \param [out] lpn_handle Pointer to an LPN Handle, which will be filled
+ if match found
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_is_valid_lpn_subscription_address
+(
+ /* IN */ MS_NET_ADDR addr,
+ /* OUT */ LPN_HANDLE* lpn_handle
+);
+
+/**
+ \brief To check if valid uicast address of an LPN to receive a packet
+
+ \par Description
+ This routine checks if destination address in a received packet matches
+ with any of the known subscription address of an LPN.
+
+ \param [in] addr Address to search
+ \param [in] lpn_handle An LPN Handle, which will be filled
+ if match found
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_is_valid_lpn_uincast_address
+(
+ /* IN */ MS_NET_ADDR addr,
+ /* IN */ LPN_HANDLE lpn_handle
+);
+
+/**
+ \brief To get Poll Timeout of an LPN
+
+ \par Description
+ This routine checks if LPN address is valid and then returns
+ Poll Timeout configured for the LPN.
+
+ \param [in] lpn_addr LPN Address to search
+ \param [out] poll_timeout Memory where poll timeout of the LPN to be filled
+ (if match found)
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_get_lpn_polltimeout
+(
+ /* IN */ MS_NET_ADDR lpn_addr,
+ /* OUT */ UINT32* poll_timeout
+);
+
+/**
+ \brief To get the LPN node information
+
+ \par Description
+ This routine fetches the node information of the LPN element at the
+ given index
+
+ \param [in] role Local friendship role
+ \param [in] lpn_index Index of the LPN element
+ \param [out] node Pointer to copy the information
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_get_frndship_info
+(
+ UINT8 role,
+ UINT16 lpn_index,
+ MS_TRN_FRNDSHIP_INFO* node
+);
+
+/**
+ \brief To add the security update information
+
+ \par Description
+ This routine updates the security state of the network to all the active
+ LPN elements. This will be forwarded to the elements when it polls for the
+ next packet available.
+
+ \param [in] subnet_handle Handle to identitfy the network.
+ \param [in] flag Flag indicating the Key Refresh and IV Update state.
+ \param [in] ivindex Current IV Index of teh network.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_lpn_register_security_update
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UCHAR flag,
+ /* IN */ UINT32 ivindex
+);
+
+/**
+ \brief To clear information related to all LPNs
+
+ \par Description
+ This routine clears information related to all LPNs.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_clear_all_lpn
+(
+ void
+);
+
+/**
+ \brief To set the Heartbeat publication data
+
+ \par Description
+ This routine configures the Heartbeat publication information
+
+ \param [out] info Heartbeat Publication information data as
+ in \ref MS_TRN_HEARTBEAT_PUBLICATION_INFO
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_set_heartbeat_publication
+(
+ /* INOUT */ MS_TRN_HEARTBEAT_PUBLICATION_INFO* info
+);
+
+/**
+ \brief To get the Heartbeat publication data
+
+ \par Description
+ This routine retrieves the Heartbeat publication information
+
+ \param [out] info Heartbeat Publication information data as
+ in \ref MS_TRN_HEARTBEAT_PUBLICATION_INFO
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_get_heartbeat_publication
+(
+ /* OUT */ MS_TRN_HEARTBEAT_PUBLICATION_INFO* info
+);
+
+
+/**
+ \brief To set the Heartbeat subscription data
+
+ \par Description
+ This routine configures the Heartbeat subscription information
+
+ \param [in, out] info Heartbeat Subscription information data as
+ in \ref MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_set_heartbeat_subscription
+(
+ /* INOUT */ MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO* info
+);
+
+/**
+ \brief To get the Heartbeat subscription data
+
+ \par Description
+ This routine retrieves the Heartbeat subscription information
+
+ \param [out] info Heartbeat Subscription information data as
+ in \ref MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_get_heartbeat_subscription
+(
+ /* OUT */ MS_TRN_HEARTBEAT_SUBSCRIPTION_INFO* info
+);
+
+/**
+ \brief To trigger Heartbeat send on change in feature
+
+ \par Description
+ This routine triggers the Heartbeat send on change in state of supported
+ features.
+
+ \param [in] change_in_feature_bit Bit mask of the changed feature field
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT MS_trn_trigger_heartbeat (/* IN */ UINT8 change_in_feature_bit);
+
+void trn_stop_heartbeat_pub_timer(void);
+
+void trn_start_heartbeat_sub_timer(/* IN */ UINT32 timeout);
+
+void trn_stop_heartbeat_sub_timer(void);
+
+void trn_heartbeat_timer_restart(void);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+/** \} */
+
+/** \} */
+
+#endif /* _H_MS_TRN_API_ */
+
diff --git a/src/components/ethermind/mesh/export/include/MS_version.h b/src/components/ethermind/mesh/export/include/MS_version.h
new file mode 100644
index 0000000..68ba1e7
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/MS_version.h
@@ -0,0 +1,112 @@
+
+/**
+ \file MS_version.h
+
+ This EtherMind Header File containing version number of the stack.
+*/
+
+/*
+ Copyright (C) 2017. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_VERSION_
+#define _H_MS_VERSION_
+
+/* -------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+
+/* -------------------------------------------- Global Definitions */
+
+/**
+ An increment in the major number of the stack implies a large update to
+ the stack. Such an update could occur due to multiple factors, including
+ changes to stack to adhere to new version of the specification or
+ support for new device specializations or in extreme cases a design
+ overhaul to address future needs.
+
+ An update in the major number would signify an update to the application
+ interface offered by the stack. Update need not necessarily imply a
+ change in existing interface, it could be additional APIs or events.
+ When an increment in major number occurs, minor & sub-minor numbers
+ are reset to zero. In event of minor number reaching 255, the max
+ permissible number, a change resulting in increment in minor version
+ number will result in increment in major number.
+*/
+#define MS_MAJOR_VERSION_NUMBER 1
+
+/**
+ An increment in the minor number of the stack implies an update to fix
+ an observed defect or changes resulting from optimzations performed on the
+ stack or enhancement to accommodate addendums to specifications. Minor
+ utility functions added may also result in increase in this number, however
+ none of these changes are categorized as causing an increment in minor
+ number, cause any change in existing interface. It is possible that an
+ existing functionality is required to be conditionally included; hence
+ feature flag may be introduced to enable or disable inclusion of the
+ functionality. Such a change would be categorized under a change resulting
+ in increment in minor number.
+ When an increment in minor number occurs, sub-minor number is reset
+ to zero. In event of sub-minor number reaching 255, the max permissible
+ number, a change resulting in increment in sub-minor number will result in
+ increment in minor number.
+*/
+#define MS_MINOR_VERSION_NUMBER 2
+
+/**
+ An increment in this number implies a trivial change, changes such as
+ update in debug log, updating comments, macros, conditions renaming,
+ internal function/variable names etc are viewed as changes that result in
+ increment in this number.
+*/
+#define MS_SUB_MINOR_VERSION_NUMBER 0
+
+/* -------------------------------------------- Macros */
+
+/* -------------------------------------------- Structures/Data Types */
+
+/** Version Number Structure */
+typedef struct _MS_VERSION_NUMBER
+{
+ /** Major Version Number */
+ UCHAR major;
+
+ /** Minor Version Number */
+ UCHAR minor;
+
+ /** Sub-minor Version Number */
+ UCHAR subminor;
+
+} MS_VERSION_NUMBER;
+
+/* -------------------------------------------- Function/API Declarations */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef MS_SUPPORT_STACK_VERSION_INFO
+/**
+ \brief Routine to get Stack Version Number
+
+ \par Description
+ Routine to get the version number of the stack as return value.
+ The version number consists of 3 fields:
+ Major Number
+ Minor Number
+ Sub-minor Number
+
+ \param [out] version_number
+ Pointer to \ref MS_VERSION_NUMBER structure to be filled.
+*/
+void MS_get_version_number
+(
+ /* OUT */ MS_VERSION_NUMBER* version_number
+);
+#endif /* MS_SUPPORT_STACK_VERSION_INFO */
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _H_MS_VERSION_ */
+
diff --git a/src/components/ethermind/mesh/export/include/access_extern.h b/src/components/ethermind/mesh/export/include/access_extern.h
new file mode 100644
index 0000000..77e0b8b
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/access_extern.h
@@ -0,0 +1,108 @@
+
+/**
+ \file access_extern.h
+
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_ACCESS_EXTERN_
+#define _H_ACCESS_EXTERN_
+
+#include "MS_access_api.h"
+
+/* --------------------------------------------- Data Types/ Structures */
+
+/** Current IV Index and Update State */
+typedef struct _MS_ACCESS_IV_INDEX
+{
+ /** Current IV Index */
+ UINT32 iv_index;
+
+ /** Current IV Update State */
+ UINT8 iv_update_state;
+
+ /** IV Update time expire */
+ UINT32 iv_expire_time;
+
+} MS_ACCESS_IV_INDEX;
+
+
+/* --------------------------------------------- Global Definitions */
+#define NVS_FLASH_BASE1 0x39000
+#define NVS_FLASH_BASE2 0x3a000
+
+/* --------------------------------------------- External Global Definitions */
+/**
+ Current IV Index and associated update state
+*/
+extern MS_ACCESS_IV_INDEX ms_iv_index;
+
+extern UINT8 access_default_ttl;
+
+/** Start unicast Address */
+extern MS_NET_ADDR ms_start_unicast_addr;
+
+/** Stop unicast Address */
+extern MS_NET_ADDR ms_stop_unicast_addr;
+
+
+extern UINT8 ms_ps_store_disable_flag;
+extern MS_NET_ADDR ms_provisioner_addr;
+
+extern UINT8 rx_test_ttl;
+extern UINT8 vendor_tid;
+
+
+
+
+/* Macro to get default TTL primary unicast address */
+#define ACCESS_CM_GET_DEFAULT_TTL(ttl) \
+ (ttl) = access_default_ttl
+
+/* Macro to get rx TTL primary unicast address */
+#define ACCESS_CM_GET_RX_TTL(ttl) \
+ (ttl) = rx_test_ttl
+
+
+API_RESULT MS_access_raw_data
+(
+ /* IN */ MS_ACCESS_MODEL_HANDLE* handle,
+ /* IN */ UINT32 opcode,
+ /* IN */ MS_NET_ADDR dst_addr,
+ /* IN */ MS_APPKEY_HANDLE appKeyHandle,
+ /* IN */ UCHAR* data_param,
+ /* IN */ UINT16 data_len,
+ /* IN */ UINT8 reliable
+);
+
+/** Get Publish Address */
+API_RESULT MS_access_get_publish_addr
+(
+ /* IN */ MS_ACCESS_MODEL_HANDLE* handle,
+ /* IN */ MS_NET_ADDR* publish_addr
+);
+
+
+/** Publish */
+API_RESULT MS_access_publish_ex
+(
+ /* IN */ MS_ACCESS_MODEL_HANDLE* handle,
+ /* IN */ UINT32 opcode,
+ /* IN */ MS_NET_ADDR dst_addr,
+ /* IN */ UCHAR* data_param,
+ /* IN */ UINT16 data_len,
+ /* IN */ UINT8 reliable
+);
+
+/** Store all record */
+void MS_access_ps_store_all_record(void);
+
+API_RESULT MS_access_ps_store_disable(UINT8 enable);
+
+API_RESULT MS_access_ps_crc_check(void);
+#endif /* _H_ACCESS_EXTERN_ */
+
diff --git a/src/components/ethermind/mesh/export/include/fsm_defines.h b/src/components/ethermind/mesh/export/include/fsm_defines.h
new file mode 100644
index 0000000..110a4b6
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/fsm_defines.h
@@ -0,0 +1,107 @@
+
+/**
+ \file fsm_defines.h
+
+ This file defines state and events related to FSM.
+*/
+
+/*
+ Copyright (C) 2013. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_FSM_DEFINES_
+#define _H_FSM_DEFINES_
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+
+/* --------------------------------------------- Global Definitions */
+#define FSM_MAX_MODULES 2
+
+/* --------------------------------------------- Structures/Data Types */
+
+typedef UINT32 STATE_T;
+
+typedef UCHAR EVENT_T;
+
+typedef API_RESULT (*SE_HNDLR_T)(void*);
+
+typedef API_RESULT RETVAL_T;
+
+typedef struct
+{
+ STATE_T set_bits;
+} FSM_STATE_MASK;
+
+typedef struct
+{
+ RETVAL_T handler_retval;
+ FSM_STATE_MASK next_state;
+
+} RETVAL_TABLE_T;
+
+/*
+ Event Handler Table.
+ Current State, handler(if any), num_of_retval, retval_table_start_index,
+ num_of_substates handles this event,
+ start_index_of_those_handler_in_this_same_table
+*/
+
+typedef struct
+{
+ STATE_T current_state;
+ SE_HNDLR_T handler;
+
+} EVENT_HANDLER_TABLE_T;
+
+#define EVENT_HANDLER_TABLE EVENT_HANDLER_TABLE_T
+
+/* State-Event Table.
+ Event, Default Handler, num_of_retval, retval_table_start_index,
+ num_of_substates handles this event,
+ start_index_of_those_handler_in_this_same_table
+*/
+typedef struct
+{
+ EVENT_T event;
+ UINT32 event_handler_table_end_index;
+ UINT32 event_handler_table_start_index;
+
+} STATE_EVENT_TABLE_T;
+
+#define STATE_EVENT_TABLE STATE_EVENT_TABLE_T
+
+/* State identifier */
+typedef struct
+{
+ STATE_T state;
+} STATE_TABLE_T;
+
+typedef void (*FSM_STATE_CHANGE_HANDLER)(void* param, STATE_T state) DECL_REENTRANT;
+
+typedef API_RESULT (*FSM_STATE_ACCESS_HANDLER)(void* param, STATE_T* state) DECL_REENTRANT;
+
+typedef UCHAR FSM_STATE_SIZE_T;
+
+typedef struct fsm_module_t
+{
+ /* Function to Access State of Module */
+ FSM_STATE_ACCESS_HANDLER state_access_handler;
+
+ /* State Change Function Registered with FSM */
+ FSM_STATE_CHANGE_HANDLER state_change_handler;
+
+ /* Event Handler Table */
+ DECL_CONST EVENT_HANDLER_TABLE* event_table;
+
+ /* State Event Table */
+ DECL_CONST STATE_EVENT_TABLE* state_event_table;
+
+ /* State Event Table Size */
+ FSM_STATE_SIZE_T state_event_table_size;
+
+} FSM_MODULE_TABLE_T;
+
+#endif /* _H_FSM_DEFINES_ */
+
diff --git a/src/components/ethermind/mesh/export/include/fsm_engine.h b/src/components/ethermind/mesh/export/include/fsm_engine.h
new file mode 100644
index 0000000..d986cc7
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/fsm_engine.h
@@ -0,0 +1,72 @@
+
+/**
+ \file fsm_engine.h
+
+ This file defines interface offered by the FSM module.
+*/
+
+/*
+ Copyright (C) 2013. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_FSM_ENGINE_
+#define _H_FSM_ENGINE_
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+#include "fsm_defines.h"
+
+
+#ifndef FSM_NO_DEBUG
+ #ifdef VAR_ARG_IN_MACRO_NOT_SUPPORTED
+ #define FSM_ERR
+ #else
+ #define FSM_ERR(...) EM_debug_error(MS_MODULE_ID_FSM,__VA_ARGS__)
+ #endif /* VAR_ARG_IN_MACRO_NOT_SUPPORTED */
+#else /* FSM_NO_DEBUG */
+ #define FSM_ERR EM_debug_null
+#endif /* FSM_NO_DEBUG */
+
+#ifdef FSM_DEBUG
+
+ #define FSM_TRC(...) EM_debug_trace(BT_MODULE_ID_FSM,__VA_ARGS__)
+ #define FSM_INF(...) EM_debug_info(BT_MODULE_ID_FSM,__VA_ARGS__)
+
+#else /* FSM_DEBUG */
+ #ifdef VAR_ARG_IN_MACRO_NOT_SUPPORTED
+ #define FSM_TRC
+ #define FSM_INF
+ #else
+ #define FSM_TRC EM_debug_null
+ #define FSM_INF EM_debug_null
+ #endif /* VAR_ARG_IN_MACRO_NOT_SUPPORTED */
+
+#endif /* FSM_DEBUG */
+
+/* --------------------------------------------- Functions */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ms_fsm_init (void);
+
+API_RESULT ms_fsm_register_module
+(
+ /* IN */ DECL_CONST FSM_MODULE_TABLE_T* module_fsm,
+ /* OUT */ UCHAR* fsm_id
+);
+
+API_RESULT ms_fsm_post_event
+(
+ UCHAR fsm_id,
+ EVENT_T fsm_event,
+ void* param
+);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _H_FSM_ENGINE_ */
+
diff --git a/src/components/ethermind/mesh/export/include/ltrn_extern.h b/src/components/ethermind/mesh/export/include/ltrn_extern.h
new file mode 100644
index 0000000..f8d1515
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/ltrn_extern.h
@@ -0,0 +1,37 @@
+
+/**
+ \file ltrn_extern.h
+
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_LTRN_EXTERN_
+#define _H_LTRN_EXTERN_
+
+/* --------------------------------------------- External Global Definitions */
+/* Module Mutex */
+MS_DEFINE_MUTEX_TYPE(extern, ltrn_mutex)
+
+/* Module callback pointer */
+extern LTRN_NTF_CB ltrn_callback;
+
+
+
+API_RESULT ltrn_delete_from_reassembled_cache
+(
+ /* IN */ MS_NET_ADDR addr
+);
+
+API_RESULT ltrn_delete_from_replay_cache
+(
+ /* IN */ MS_NET_ADDR addr
+);
+
+
+
+#endif /* _H_LTRN_EXTERN_ */
+
diff --git a/src/components/ethermind/mesh/export/include/net_extern.h b/src/components/ethermind/mesh/export/include/net_extern.h
new file mode 100644
index 0000000..605f5e8
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/net_extern.h
@@ -0,0 +1,49 @@
+
+/**
+ \file net_extern.h
+
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_NET_EXTERN_
+#define _H_NET_EXTERN_
+
+#include "MS_net_api.h"
+
+
+/* --------------------------------------------- External Global Definitions */
+/* Module Mutex */
+MS_DEFINE_MUTEX_TYPE(extern, net_mutex)
+
+/* Module callback pointer */
+extern NET_NTF_CB net_callback;
+
+/* Network Sequence Number */
+extern NET_SEQ_NUMBER_STATE net_seq_number_state;
+
+extern UINT8 seq_num_init_flag;
+extern UINT32 g_iv_update_index;
+extern UINT8 g_iv_update_state;
+extern UINT8 g_iv_update_start_timer;
+extern UINT8 MS_key_refresh_active;
+
+extern UINT16 ms_proxy_filter_addr[5];
+
+/* Network Cache */
+//MS_DECLARE_GLOBAL_ARRAY(NET_CACHE_ELEMENT, net_cache, MS_CONFIG_LIMITS(MS_NET_CACHE_SIZE));
+
+//extern UINT16 net_cache_start;
+//extern UINT16 net_cache_size;
+
+API_RESULT net_delete_from_cache
+(
+ /* IN */ MS_NET_ADDR addr
+);
+
+
+#endif /* _H_NET_EXTERN_ */
+
diff --git a/src/components/ethermind/mesh/export/include/net_internal.h b/src/components/ethermind/mesh/export/include/net_internal.h
new file mode 100644
index 0000000..8fac33b
--- /dev/null
+++ b/src/components/ethermind/mesh/export/include/net_internal.h
@@ -0,0 +1,568 @@
+
+/**
+ \file net_internal.h
+
+ Module Internal Header File contains structure definitions including tables
+ maintained by the module
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_NET_INTERNAL_
+#define _H_NET_INTERNAL_
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+#include "MS_net_api.h"
+#include "MS_brr_api.h"
+
+/* --------------------------------------------- Global Definitions */
+
+#ifdef NET_NO_DEBUG
+ #define NET_ERR EM_debug_null
+#else /* NET_NO_DEBUG */
+ #ifdef VAR_ARG_IN_MACRO_NOT_SUPPORTED
+ #define NET_ERR
+ #else
+ #define NET_ERR(...) EM_debug_error(MS_MODULE_ID_NET, __VA_ARGS__)
+ #endif /* VAR_ARG_IN_MACRO_NOT_SUPPORTED */
+#endif /* NET_NO_DEBUG */
+
+#ifdef NET_DEBUG
+ #ifdef VAR_ARG_IN_MACRO_NOT_SUPPORTED
+ #define NET_TRC
+ #define NET_INF
+
+ #define NET_debug_dump_bytes(data, datalen)
+
+ #else
+ #define NET_TRC(...) EM_debug_trace(MS_MODULE_ID_NET,__VA_ARGS__)
+ #define NET_INF(...) EM_debug_info(MS_MODULE_ID_NET,__VA_ARGS__)
+
+ #define NET_debug_dump_bytes(data, datalen) EM_debug_dump_bytes(MS_MODULE_ID_NET, (data), (datalen))
+
+ #endif /* VAR_ARG_IN_MACRO_NOT_SUPPORTED */
+#else /* NET_DEBUG */
+ #define NET_TRC EM_debug_null
+ #define NET_INF EM_debug_null
+
+ #define NET_debug_dump_bytes(data, datalen)
+
+#endif /* NET_DEBUG */
+
+/**
+ Locks the NET Mutex which prevents any global variable being
+ overwritten by any function. It returns an error if mutex lock fails.
+*/
+#define NET_LOCK()\
+ MS_MUTEX_LOCK(net_mutex, NET)
+
+/**
+ Locks the NET_mutex which prevents any global variable being
+ overwritten by any function. To be used in void function as it
+ returns no error.
+*/
+#define NET_LOCK_VOID()\
+ MS_MUTEX_LOCK_VOID(net_mutex, NET)
+
+/**
+ Unlocks the NET_mutex which realeses the global variables
+ to be written into. It returns an error if mutex unlock fails.
+*/
+#define NET_UNLOCK()\
+ MS_MUTEX_UNLOCK(net_mutex, NET)
+
+/**
+ Unlocks the NET_mutex which realeses the global variables
+ to be written into. To be used in void functions as it returns
+ no error.
+*/
+#define NET_UNLOCK_VOID()\
+ MS_MUTEX_UNLOCK_VOID(net_mutex, NET)
+
+
+#define net_alloc_mem(size)\
+ EM_alloc_mem(size)
+
+#define net_free_mem(ptr)\
+ EM_free_mem(ptr)
+
+#ifndef NET_NO_NULL_PARAM_CHECK
+/** Null Check of Network API Parameters */
+#define NET_NULL_CHECK(x) \
+ if (NULL == (x)) \
+ { \
+ NET_ERR( \
+ "[NET] NULL Pointer detected. Referrence Impossible\n"); \
+ return NET_NULL_PARAMETER_NOT_ALLOWED; \
+ }
+#else
+#define NET_NULL_CHECK(x)
+#endif /* NET_NO_NULL_PARAM_CHECK */
+
+#ifndef MS_NET_NO_RANGE_CHECK
+/** Range Check for Network API Parameters */
+#define NET_RANGE_CHECK_START(param, start) \
+ if ( ! ((param) >= (start)) ) \
+ { \
+ NET_ERR( \
+ "[NET] NET Range Check FAILED\n"); \
+ return NET_PARAMETER_OUTSIDE_RANGE; \
+ }
+
+#define NET_RANGE_CHECK_END(param, end) \
+ if ( ! ((param) <= (end)) ) \
+ { \
+ NET_ERR( \
+ "[NET] NET Range Check FAILED\n"); \
+ return NET_PARAMETER_OUTSIDE_RANGE; \
+ }
+
+#define NET_RANGE_CHECK(param, start, end) \
+ if ( ! ( ((param) >= (start)) && ((param) <= (end)) ) ) \
+ { \
+ NET_ERR( \
+ "[NET] NET Range Check FAILED\n"); \
+ return NET_PARAMETER_OUTSIDE_RANGE; \
+ }
+
+#else
+#define NET_RANGE_CHECK_START(param, start)
+#define NET_RANGE_CHECK_END(param, end)
+#define NET_RANGE_CHECK(param, start, end)
+#endif /* NET_NO_RANGE_CHECK */
+
+/** Network Header Size */
+#define NET_HDR_SIZE 9
+
+/** Maximum Network Payload Size - TransportPDU can be 8 to 128 bits */
+#define NET_MAX_PAYLOAD_SIZE 16
+
+/** Network MIC Size - 32 or 64 bits. */
+#define NET_MIN_MIC_SIZE 4
+#define NET_MAX_MIC_SIZE 8
+
+/** Sequence Number related macro defines */
+#define NET_INIT_SEQ_NUM_STATE() \
+ net_seq_number_state.seq_num = 0; \
+ net_seq_number_state.block_seq_num_max = 0
+
+/**
+ (all-nodes address) OR
+ ((all-relays address) AND (Relay funcationality is enabled))
+ ((all-friends address) AND (Friend funcationality is enabled))
+ ((all-proxies address) AND (Proxy funcationality is enabled))
+*/
+#define NET_ADDR_FROM_FIXED_GROUP(addr) \
+ (((MS_NET_ADDR_ALL_NODES == (addr)) ||\
+ (MS_NET_ADDR_ALL_RELAYS == (addr)) ||\
+ (MS_NET_ADDR_ALL_FRIENDS == (addr)) ||\
+ (MS_NET_ADDR_ALL_PROXIES == (addr))) ? MS_TRUE: MS_FALSE)
+
+/**
+ RFU: 0xFF00 - 0xFFFB
+*/
+#define NET_ADDR_FROM_RFU(addr) \
+ (((0xFF00 <= (addr)) && (0xFFFB >= (addr))) ? MS_TRUE : MS_FALSE)
+
+/**
+ Network Proxy Filter List Count is ONE less that configured network interface.
+ First (0-th) network interface is used for Advertising Channel.
+*/
+#define PROXY_FILTER_LIST_COUNT (MS_CONFIG_LIMITS(MS_NUM_NETWORK_INTERFACES) - 1)
+
+
+/* --------------------------------------------- Data Types/ Structures */
+/** Network Cache Data Structure */
+typedef struct _NET_CACHE_ELEMENT
+{
+ /** Least significant bit of IV Index - 1 bit */
+ UINT8 ivi;
+
+ /**
+ Value derived from the NetKey used to identify
+ the Encrytion Key and Privacy Key used to secure
+ this PDU - 7 bits
+ */
+ UINT8 nid;
+
+ /** 16 Bit Source Address */
+ MS_NET_ADDR saddr;
+
+ /** 24 bit sequence number */
+ UINT32 seq_num;
+
+} NET_CACHE_ELEMENT;
+
+/** Network Interface Packet Type - Network Packet or Proxy Packet */
+typedef UINT8 NETIF_PKT_T;
+
+/**
+ NOTE: The below define values of NETIF_PKT_T_NETWORK and NETIF_PKT_T_RELAY
+ 'SHALL' not be modified. The Network logic is dependent on these
+ values.
+*/
+#define NETIF_PKT_T_NETWORK 0x00
+#define NETIF_PKT_T_RELAY 0x01
+#define NETIF_PKT_T_PROXY 0x02
+
+#define NETIF_PKT_T_RELAY_MASK NETIF_PKT_T_RELAY
+
+#if ((NETIF_PKT_T_NETWORK != 0x00) || (NETIF_PKT_T_RELAY != 0x01) || (NETIF_PKT_T_RELAY_MASK != NETIF_PKT_T_RELAY))
+ #error "NETIF_PKT_T defines modified !!"
+#endif /* ((NETIF_PKT_T_NETWORK != 0x00) || (NETIF_PKT_T_RELAY != 0x01) || (NETIF_PKT_T_RELAY_MASK != NETIF_PKT_T_RELAY)) */
+
+/** Network Tx Queue */
+typedef struct _NET_TX_Q_ELEMENT
+{
+ /* "Allocated" Data Pointer */
+ UINT8* allocated_data;
+
+ /*
+ Data Length. If data length is zero, the element is considered
+ invalid.
+ If data_length is 0, element is not valid.
+ */
+ UINT16 data_length;
+
+ /* Transmission Count */
+ UINT8 tx_count;
+
+ /* Transmission Interval */
+ UINT8 tx_interval;
+
+ /* Type of the Packet */
+ NETIF_PKT_T type;
+
+ /* Destination Address */
+ MS_NET_ADDR d_addr;
+
+ /* Check Transmission Type(seg)*/
+ UINT8 unsegment;
+
+ /* Transmission Flag*/
+ UINT8 tx_flag;
+
+} NET_TX_Q_ELEMENT;
+
+/** Proxy Filter List */
+typedef struct _PROXY_FILTER_LIST
+{
+ /* Proxy Address List */
+ MS_DEFINE_GLOBAL_ARRAY(PROXY_ADDR, p_addr, MS_CONFIG_LIMITS(MS_PROXY_FILTER_LIST_SIZE));
+ MS_DEFINE_GLOBAL_ARRAY(PROXY_ADDR, v_addr, MS_CONFIG_LIMITS(MS_PROXY_FILTER_LIST_SIZE));
+
+ /* Proxy Address List Active Count */
+ UINT16 p_count;
+
+ /* Proxy Address List Active Count */
+ UINT16 v_count;
+
+ /* Proxy List Filter Type */
+ PROXY_FILTER_TYPE type;
+
+ /* Proxy Server/Client Role */
+ UCHAR role;
+
+} PROXY_FILTER_LIST;
+
+//DECL_STATIC MS_DEFINE_GLOBAL_ARRAY(PROXY_FILTER_LIST, net_proxy_list, PROXY_FILTER_LIST_COUNT);
+
+
+//UINT16 proxy_filter_table[MS_PROXY_FILTER_LIST_SIZE];
+
+
+/* TODO: Move to Limits.h */
+/* NET TX Q */
+//#define NET_TX_QUEUE_SIZE 30 //20 ->30 by ZQ
+#define NET_TX_QUEUE_SIZE 40 //30 ->40 by HQ
+
+
+/* TODO: To be dynamically adjusted based on the type of packet and corresponding configuration redefine by hq*/
+#define NET_TX_TIMEOUT (EM_TIMEOUT_MILLISEC | 15) /* Millisecond */
+
+MS_DECLARE_GLOBAL_ARRAY(NET_CACHE_ELEMENT, net_cache, MS_CONFIG_LIMITS(MS_NET_CACHE_SIZE));
+
+
+extern UINT16 net_cache_start;
+extern UINT16 net_cache_size;
+
+
+
+/* --------------------------------------------- Functions */
+/**
+ \par Description
+ This function handles the incoming data received over a network interface.
+
+ \param [in] type
+ Network Inteface Packet Type
+ \param [in] handle
+ Network Interface Handle
+ \param [in] pdata
+ The incoming Data Packet
+ \param [in] pdatalen
+ Size of the incoming Data Packet
+*/
+void net_pkt_in
+(
+ /* IN */ NETIF_PKT_T type,
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ UCHAR* pdata,
+ /* IN */ UINT16 pdatalen
+);
+
+API_RESULT netif_adv_recv_cb (BRR_HANDLE* handle, UCHAR pevent, UCHAR* pdata, UINT16 pdatalen);
+API_RESULT netif_gatt_recv_cb (BRR_HANDLE* handle, UCHAR pevent, UCHAR* pdata, UINT16 pdatalen);
+
+/* Initialize network cache */
+void net_init_cache (void);
+
+/* Is already in cache? */
+API_RESULT net_is_in_cache
+(
+ /* IN */ MS_NET_HEADER* hdr
+);
+
+/* Add to cache */
+API_RESULT net_add_to_cache
+(
+ /* IN */ MS_NET_HEADER* hdr
+);
+
+/**
+ Routine to decode a received Network PDU,
+ based on a specific network Key from the store.
+ This function returns status of the decode operation.
+ If success, return the decoded network header and PDU.
+*/
+API_RESULT net_decode_frame
+(
+ /* IN */ NETIF_PKT_T type,
+ /* IN */ UCHAR* pdata,
+ /* IN */ UINT16 pdatalen,
+ /* OUT */ MS_SUBNET_HANDLE* subnet_handle,
+ /* OUT */ MS_NET_HEADER* net_hdr,
+ /* OUT */ UCHAR* trn_pdu,
+ /* OUT */ UINT16* trn_pdu_len
+);
+
+/**
+ \par Description
+ This function obfuscates or de-obfuscates a network header.
+
+ \param [in] network_pkt
+ Network Packet
+ \param [in] privacy_key
+ Privacy Key
+ \param [in] pecb_input
+ PECB Input
+ \param [out] pecb_output
+ PECB Output. Can not be same pointer as PECB Input.
+*/
+void net_obfuscate
+(
+ /* IN */ UINT8* network_pkt,
+ /* IN */ UINT8* privacy_key,
+ /* IN */ UINT8* pecb_input,
+ /* OUT */ UINT8* pecb_output
+);
+
+/**
+ \par Description
+ This macro de-obfuscates a network header.
+
+ \param [in] network_pkt
+ Network Packet
+ \param [in] privacy_key
+ Privacy Key
+ \param [in] pecb_input
+ PECB Input
+ \param [out] pecb_output
+ PECB Output. Can not be same pointer as PECB Input.
+*/
+#define net_de_obfuscate(network_pkt, privacy_key, pecb_input, pecb_output) \
+ net_obfuscate((network_pkt), (privacy_key), (pecb_input), (pecb_output))
+
+/**
+ \par Description
+ This function creaets input bytes to be used for PECB.
+
+ \param [in] iv_index
+ Network IV Index
+ \param [in] network_pkt
+ Network Packet
+ \param [out] pecb_input
+ Buffer where PECB input bytes to be prepared
+*/
+void net_create_pecb_input
+(
+ /* IN */ UINT32 iv_index,
+ /* IN */ UINT8* network_pkt,
+ /* OUT */ UINT8* pecb_input
+);
+
+/**
+ \par Description
+ This function sends data over a network interface.
+
+ \param [in] hdr
+ Network Header for the transmit packet
+ \param [in] subnet_handle
+ Handle identifying associated subnet on which the packet to be transmitted
+ \param [in] buffer
+ Outgoing Data Packet
+ \param [in] is_relay
+ Flag
+ \ref MS_TRUE : If the packet to be tagged as relay
+ \ref MS_FALSE: Otherwise
+*/
+API_RESULT net_pkt_send
+(
+ /* IN */ MS_NET_HEADER* hdr,
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ MS_BUFFER* buffer,
+ /* IN */ UINT8 is_relay,
+ /* IN */ UINT8 is_seg
+);
+
+/* netif interfaces */
+API_RESULT netif_init (void);
+API_RESULT netif_deinit (void);
+API_RESULT netif_send (NETIF_PKT_T type, MS_NET_ADDR d_addr, UCHAR* pdata, UINT16 pdatalen,UINT8 unsegment_flag,UINT8 tx_flag);
+
+/* Network Tx Queue routines */
+void net_tx_queue_init(void);
+API_RESULT net_tx_enqueue
+(
+ /* IN */ NETIF_PKT_T type,
+ /* IN */ MS_NET_ADDR d_addr,
+ /* IN */ UINT8* buffer,
+ /* IN */ UINT16 buffer_len,
+ /* IN */ UINT8 is_seg
+);
+API_RESULT net_trigger_tx(void);
+void net_tx_timeout_handler(void* args, UINT16 size);
+
+#ifdef MS_PROXY_SERVER
+/* GATT Proxy Server Related defines */
+#define net_proxy_server_add_to_list(h,a,c,f) \
+ net_proxy_server_filter_op \
+ ( \
+ (h), \
+ MS_PROXY_ADD_TO_FILTER_OPCODE, \
+ (a), \
+ (c), \
+ (f) \
+ );
+
+#define net_proxy_server_del_from_list(h,a,c,f) \
+ net_proxy_server_filter_op \
+ ( \
+ (h), \
+ MS_PROXY_REM_FROM_FILTER_OPCODE, \
+ (a), \
+ (c), \
+ (f) \
+ );
+#endif /* MS_PROXY_SERVER */
+
+/* TODO: Protect by Proxy Feature */
+/* Init functons */
+API_RESULT net_proxy_init(void);
+
+void net_proxy_iface_up (NETIF_HANDLE* handle, UCHAR role);
+void net_proxy_iface_down(NETIF_HANDLE* handle);
+
+/**
+ Interface for Network layer to inform Proxy of the received
+ Packets which are intended for the Proxy[Configuration Messages].
+
+ \param net_hdr Network Header.
+ \param netif_handle Network Interface Handle.
+ \param subnet_handle Associated Subnet Handle.
+ \param data_param Data associated with the event if any or NULL.
+ \param data_len Size of the event data. 0 if event data is NULL.
+*/
+void net_proxy_recv
+(
+ MS_NET_HEADER* net_hdr,
+ NETIF_HANDLE* handle,
+ MS_SUBNET_HANDLE subnet_handle,
+ UCHAR* data_param,
+ UINT16 data_len
+);
+
+/**
+ \brief Send a Proxy PDU
+
+ \par Description
+ This routine sends a PDU from the Mesh stack to over the Proxy
+ indicated by the Proxy Type.
+
+ \param [in] subnet_handle
+ subnet_handle on which PDU is to be sent.
+
+ \param [in] pdu
+ PDU data to be sent.
+
+ \param [in] pdu_len
+ length of PDU data to be sent.
+
+ \return API_SUCCESS or an error code indicating reason for failure
+*/
+API_RESULT net_proxy_send
+(
+ /* IN */ MS_SUBNET_HANDLE subnet_handle,
+ /* IN */ UCHAR* pdu,
+ /* IN */ UINT16 pdu_len
+);
+
+#ifdef MS_PROXY_SERVER
+/* Interface to set, and get current proxy filter types */
+API_RESULT net_proxy_server_set_filter
+(
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ PROXY_FILTER_TYPE type
+);
+
+/* Interface to ADD, Remove to Filter List */
+API_RESULT net_proxy_server_filter_op
+(
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ UCHAR opcode,
+ /* IN */ UCHAR* pdu,
+ /* IN */ UINT16 pdu_len,
+ /* IN */ UCHAR proxy_fitlter_flg
+);
+
+/* Interface to send List Filter Status */
+void net_proxy_send_filter_status
+(
+ NETIF_HANDLE* handle,
+ MS_SUBNET_HANDLE subnet_handle
+);
+
+API_RESULT net_proxy_process_first_pkt
+(
+ /* IN */ NETIF_HANDLE* handle,
+ /* IN */ PROXY_ADDR src_addr
+);
+#endif /* MS_PROXY_SERVER */
+
+API_RESULT net_proxy_filter_check_forwarding
+(
+ NETIF_HANDLE* handle,
+ NETIF_PKT_T pkt_sub_type,
+ PROXY_ADDR d_addr
+);
+
+void net_handle_secure_beacon(UCHAR* pdata, UINT16 pdatalen);
+API_RESULT net_proxy_nodeid_adv(MS_SUBNET_HANDLE handle);
+void net_proxy_netid_timeout_handler(void* args, UINT16 size);
+void net_proxy_nodeid_timeout_handler(void* args, UINT16 size);
+
+#endif /* _H_NET_INTERNAL_ */
+
diff --git a/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.c b/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.c
new file mode 100644
index 0000000..3816d6e
--- /dev/null
+++ b/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.c
@@ -0,0 +1,68 @@
+
+/**
+ \file MS_common_pl.c
+
+ Common routines and start-up initialization & shutdown handlers
+ (Platform: Windows User Mode)
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+/* ------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+#include "MS_access_api.h"
+#include "blebrr.h"
+
+/* ------------------------------------------- External Global Variables */
+
+
+/* ------------------------------------------- External Global Variables */
+
+
+/* ------------------------------------------- External Global Variables */
+
+
+/* ------------------------------------------- Functions */
+/* EtherMind-Init: Platform Handler */
+void ms_init_pl (void)
+{
+}
+
+__ATTR_SECTION_XIP__ UINT8 MS_common_reset(void)
+{
+ UINT8 retval;
+ UINT8 proxy_state,proxy;
+ retval = MS_TRUE;
+ MS_access_cm_get_features_field(&proxy, MS_FEATURE_PROXY);
+ MS_proxy_fetch_state(&proxy_state);
+
+ if((MS_TRUE == proxy) && (proxy_state == MS_PROXY_CONNECTED))
+ {
+ blebrr_disconnect_pl();
+ retval = MS_FALSE;
+ }
+
+ #if(BLEMESH_ROLE == PROV_ROLE_PROVISIONER)
+ MS_access_cm_reset(PROV_ROLE_PROVISIONER);
+ #else
+ nvs_reset(NVS_BANK_PERSISTENT);
+ MS_access_cm_reset(PROV_ROLE_DEVICE);
+ #endif
+ return retval;
+}
+
+
+
+#ifndef MS_NO_SHUTDOWN
+
+/* Mesh Shutdown: Platform Handler */
+void ms_shutdown_pl (void)
+{
+}
+
+#endif /* MS_NO_SHUTDOWN */
+
+
diff --git a/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.h b/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.h
new file mode 100644
index 0000000..a4f25b4
--- /dev/null
+++ b/src/components/ethermind/mesh/export/platforms/ext/MS_common_pl.h
@@ -0,0 +1,54 @@
+
+/**
+ \file MS_common_pl.h
+
+ This file contains the Function Declaration, and Constant Definitions
+ for the EtherMind Mesh Stack in Windows User Mode.
+*/
+
+/*
+ Copyright (C) 2016. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#ifndef _H_MS_COMMON_PL_
+#define _H_MS_COMMON_PL_
+
+/* ------------------------------------------- Header File Inclusion */
+
+/* ------------------------------------------- Common PL Debug */
+#define PL_ERR(...) MS_debug_error(ms_debug_fd, __VA_ARGS__)
+
+#ifdef PL_DEBUG
+
+ #define PL_TRC(...) MS_debug_trace(ms_debug_fd, __VA_ARGS__)
+ #define PL_INF(...) MS_debug_info(ms_debug_fd, __VA_ARGS__)
+
+#else /* PL_DEBUG */
+
+ #define PL_TRC MS_debug_null
+ #define PL_INF MS_debug_null
+
+#endif /* PL_DEBUG */
+
+
+/* ------------------------------------------- Global Definitions/Macros */
+/* EtherMind Configuration File */
+#define MS_CONFIG_FILE "ethermind.conf"
+
+
+/* ------------------------------------------- Data Structures */
+
+
+/* ------------------------------------------- Function Declarations */
+/* EtherMind-Init: Platform Handler */
+void ms_init_pl(void);
+
+__ATTR_SECTION_XIP__ UINT8 MS_common_reset(void);
+
+
+/* Mesh Shutdown: Platform Handler */
+void ms_shutdown_pl(void);
+
+#endif /* _H_MS_COMMON_PL_ */
+
diff --git a/src/components/ethermind/mesh/export/platforms/ext/prov_pl.c b/src/components/ethermind/mesh/export/platforms/ext/prov_pl.c
new file mode 100644
index 0000000..1bc6a3b
--- /dev/null
+++ b/src/components/ethermind/mesh/export/platforms/ext/prov_pl.c
@@ -0,0 +1,48 @@
+
+/**
+ \file prov_pl.c
+
+
+*/
+
+/*
+ Copyright (C) 2013. Mindtree Limited.
+ All rights reserved.
+*/
+
+/* --------------------------------------------- Header File Inclusion */
+#include "prov_pl.h"
+
+/* --------------------------------------------- External Global Variables */
+
+/* --------------------------------------------- Exported Global Variables */
+
+/* --------------------------------------------- Static Global Variables */
+/** Out of Band Public Key information */
+DECL_STATIC UCHAR prov_dev_oob_pubkey[PROV_PUBKEY_SIZE_PL];
+
+/** Static Out of Band Authentication information */
+DECL_STATIC UCHAR prov_static_oob_auth[PROV_AUTHVAL_SIZE_PL];
+
+/* --------------------------------------------- Functions */
+
+void prov_set_device_oob_pubkey_pl(UCHAR* key, UINT16 size)
+{
+ EM_mem_copy(prov_dev_oob_pubkey, key, size);
+}
+
+void prov_read_device_oob_pubkey_pl (UCHAR* key, UINT16 size)
+{
+ EM_mem_copy(key, prov_dev_oob_pubkey, size);
+}
+
+void prov_set_static_oob_auth_pl(UCHAR* key, UINT16 size)
+{
+ EM_mem_copy(prov_static_oob_auth, key, size);
+}
+
+void prov_read_static_oob_auth_pl(UCHAR* key, UINT16 size)
+{
+ EM_mem_copy(key, prov_static_oob_auth, size);
+}
+
diff --git a/src/components/ethermind/mesh/export/platforms/ext/prov_pl.h b/src/components/ethermind/mesh/export/platforms/ext/prov_pl.h
new file mode 100644
index 0000000..ce17d3f
--- /dev/null
+++ b/src/components/ethermind/mesh/export/platforms/ext/prov_pl.h
@@ -0,0 +1,36 @@
+
+/**
+ \file prov_pl.h
+
+
+*/
+
+/*
+ Copyright (C) 2013. Mindtree Limited.
+ All rights reserved.
+*/
+
+#ifndef _H_PROV_PL_
+#define _H_PROV_PL_
+
+/* --------------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+
+/* --------------------------------------------- Global Definitions */
+#define PROV_PUBKEY_SIZE_PL 64
+#define PROV_AUTHVAL_SIZE_PL 16
+
+/* --------------------------------------------- Structures/Data Types */
+
+/* --------------------------------------------- Macros */
+
+/* --------------------------------------------- Internal Functions */
+
+/* --------------------------------------------- API Declarations */
+void prov_set_device_oob_pubkey_pl(UCHAR* key, UINT16 size);
+void prov_set_static_oob_auth_pl(UCHAR* key, UINT16 size);
+void prov_read_device_oob_pubkey_pl (UCHAR* key, UINT16 size);
+void prov_read_static_oob_auth_pl(UCHAR* key, UINT16 size);
+
+#endif /* _H_PROV_PL_ */
+
diff --git a/src/components/ethermind/mesh/export/sample/appl_sample_example_1.c b/src/components/ethermind/mesh/export/sample/appl_sample_example_1.c
new file mode 100644
index 0000000..08e6469
--- /dev/null
+++ b/src/components/ethermind/mesh/export/sample/appl_sample_example_1.c
@@ -0,0 +1,665 @@
+
+/**
+ \file appl_sample_example_1.c
+
+ Source File for Generic OnOff Server Standalone application without CLI or
+ menu based console input interface.
+*/
+
+/*
+ Copyright (C) 2018. Mindtree Ltd.
+ All rights reserved.
+*/
+
+#if (MESH_STANDALONE == 1)
+
+/* ----------------------------------------- Header File Inclusion */
+#include "MS_common.h"
+#include "MS_access_api.h"
+#include "MS_config_api.h"
+#include "MS_health_server_api.h"
+#include "MS_generic_onoff_api.h"
+#include "blebrr.h"
+#include "nvsto.h"
+#include "model_state_handler_pl.h"
+
+/* Console Input/Output */
+#define CONSOLE_OUT(...) printf(__VA_ARGS__)
+#define CONSOLE_IN(...) scanf(__VA_ARGS__)
+
+void appl_dump_bytes(UCHAR* buffer, UINT16 length);
+void appl_mesh_sample (void);
+
+/* ----------------------------------------- External Global Variables */
+
+
+/* ----------------------------------------- Exported Global Variables */
+
+
+/* ----------------------------------------- Static Global Variables */
+
+
+/* ----------------------------------------- Functions */
+/* Model Server - Foundation Models */
+
+/* Health Server - Test Routines */
+static void UI_health_self_test_00(UINT8 test_id, UINT16 company_id)
+{
+}
+
+static void UI_health_self_test_01(UINT8 test_id, UINT16 company_id)
+{
+}
+
+static void UI_health_self_test_FF(UINT8 test_id, UINT16 company_id)
+{
+}
+
+/* List of Self Tests */
+static MS_HEALTH_SERVER_SELF_TEST UI_health_server_self_tests[] =
+{
+ {
+ 0x00, /* Test ID: 0x00 */
+ UI_health_self_test_00
+ },
+ {
+ 0x01, /* Test ID: 0x01 */
+ UI_health_self_test_01
+ },
+ {
+ 0xFF, /* Test ID: 0xFF */
+ UI_health_self_test_FF
+ }
+};
+
+/**
+ \brief Health Server application Asynchronous Notification Callback.
+
+ \par Description
+ Health Server calls the registered callback to indicate events occurred to the
+ application.
+
+ \param handle Model Handle.
+ \param event_type Health Server Event type.
+ \param event_param Parameter associated with the event if any or NULL.
+ \param param_len Size of the event parameter data. 0 if event param is NULL.
+*/
+static API_RESULT UI_health_server_cb
+(
+ MS_ACCESS_MODEL_HANDLE* handle,
+ UINT8 event_type,
+ UINT8* event_param,
+ UINT16 param_len
+)
+{
+ CONSOLE_OUT(
+ "Health Server Callback. Not handled. Returning\n");
+ return API_SUCCESS;
+}
+
+static API_RESULT UI_register_foundation_model_servers
+(
+ MS_ACCESS_ELEMENT_HANDLE element_handle
+)
+{
+ /* Configuration Server */
+ MS_ACCESS_MODEL_HANDLE UI_config_server_model_handle;
+ MS_ACCESS_MODEL_HANDLE UI_health_server_model_handle;
+ API_RESULT retval;
+ /* Health Server */
+ UINT16 company_id;
+ MS_HEALTH_SERVER_SELF_TEST* self_tests;
+ UINT32 num_self_tests;
+ CONSOLE_OUT("In Model Server - Foundation Models\n");
+ retval = MS_config_server_init(element_handle, &UI_config_server_model_handle);
+ CONSOLE_OUT("Config Model Server Registration Status: 0x%04X\n", retval);
+ /* Health Server */
+ company_id = MS_DEFAULT_COMPANY_ID;
+ self_tests = &UI_health_server_self_tests[0];
+ num_self_tests = sizeof(UI_health_server_self_tests)/sizeof(MS_HEALTH_SERVER_SELF_TEST);
+ retval = MS_health_server_init
+ (
+ element_handle,
+ &UI_health_server_model_handle,
+ company_id,
+ self_tests,
+ num_self_tests,
+ UI_health_server_cb
+ );
+
+ if (API_SUCCESS == retval)
+ {
+ CONSOLE_OUT(
+ "Health Server Initialized. Model Handle: 0x%04X\n",
+ UI_health_server_model_handle);
+ }
+ else
+ {
+ CONSOLE_OUT(
+ "[ERR] Sensor Server Initialization Failed. Result: 0x%04X\n",
+ retval);
+ }
+
+ return retval;
+}
+
+
+/* ---- Generic OnOff States and Get/Set Handlers */
+static MS_STATE_GENERIC_ONOFF_STRUCT UI_generic_onoff;
+
+/* Generic OnOff Model state Initialization */
+static void UI_generic_onoff_model_states_initialization(void)
+{
+ EM_mem_set(&UI_generic_onoff, 0, sizeof(UI_generic_onoff));
+}
+
+/* Generic OnOff Model Get Handler */
+static API_RESULT UI_generic_onoff_model_state_get(UINT16 state_t, UINT16 state_inst, void* param, UINT8 direction)
+{
+ API_RESULT retval;
+ retval = API_SUCCESS;
+
+ switch(state_t)
+ {
+ case MS_STATE_GENERIC_ONOFF_T:
+ {
+ MS_STATE_GENERIC_ONOFF_STRUCT* param_p;
+ param_p = (MS_STATE_GENERIC_ONOFF_STRUCT*)param;
+ /* Ignoring Instance and direction right now */
+ *param_p = UI_generic_onoff;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return retval;
+}
+
+/* Generic OnOff Model Set Handler */
+static API_RESULT UI_generic_onoff_model_state_set(UINT16 state_t, UINT16 state_inst, void* param, UINT8 direction)
+{
+ API_RESULT retval;
+ retval = API_SUCCESS;
+
+ switch (state_t)
+ {
+ case MS_STATE_GENERIC_ONOFF_T:
+ {
+ MS_STATE_GENERIC_ONOFF_STRUCT* param_p;
+ param_p = (MS_STATE_GENERIC_ONOFF_STRUCT*)param;
+ /* Instantaneous Change */
+ UI_generic_onoff.onoff = param_p->onoff;
+ *param_p = UI_generic_onoff;
+ CONSOLE_OUT("[state] current: 0x%02X\n", UI_generic_onoff.onoff);
+ CONSOLE_OUT("[state] target: 0x%02X\n", UI_generic_onoff.target_onoff);
+ CONSOLE_OUT("[state] remaining_time: 0x%02X\n", UI_generic_onoff.transition_time);
+ generic_onoff_set_pl(param_p->onoff);
+ /* Ignoring Instance and direction right now */
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return retval;
+}
+
+/* Model state Initialization */
+static void UI_model_states_initialization(void)
+{
+ /* Generic OnOff States */
+ UI_generic_onoff_model_states_initialization();
+}
+
+/* Generic OnOff Model Server */
+/**
+ \brief Server Application Asynchronous Notification Callback.
+
+ \par Description
+ Generic_Onoff server calls the registered callback to indicate events occurred to the application.
+
+ \param [in] ctx Context of message received for a specific model instance.
+ \param [in] msg_raw Uninterpreted/raw received message.
+ \param [in] req_type Requested message type.
+ \param [in] state_params Model specific state parameters.
+ \param [in] ext_params Additional parameters.
+*/
+static API_RESULT UI_generic_onoff_server_cb
+(
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_CONTEXT* ctx,
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_RAW* msg_raw,
+ /* IN */ MS_ACCESS_MODEL_REQ_MSG_T* req_type,
+ /* IN */ MS_ACCESS_MODEL_STATE_PARAMS* state_params,
+ /* IN */ MS_ACCESS_MODEL_EXT_PARAMS* ext_params
+)
+{
+ MS_STATE_GENERIC_ONOFF_STRUCT param;
+ MS_ACCESS_MODEL_STATE_PARAMS current_state_params;
+ API_RESULT retval;
+ retval = API_SUCCESS;
+
+ /* Check message type */
+ if (MS_ACCESS_MODEL_REQ_MSG_T_GET == req_type->type)
+ {
+ CONSOLE_OUT("[GENERIC_ONOFF] GET Request.\n");
+ UI_generic_onoff_model_state_get(state_params->state_type, 0, ¶m, 0);
+ current_state_params.state_type = state_params->state_type;
+ current_state_params.state = ¶m;
+ /* Using same as target state and remaining time as 0 */
+ }
+ else if (MS_ACCESS_MODEL_REQ_MSG_T_SET == req_type->type)
+ {
+ CONSOLE_OUT("[GENERIC_ONOFF] SET Request.\n");
+ retval = UI_generic_onoff_model_state_set(state_params->state_type, 0, (MS_STATE_GENERIC_ONOFF_STRUCT*)state_params->state, 0);
+ current_state_params.state_type = state_params->state_type;
+ current_state_params.state = (MS_STATE_GENERIC_ONOFF_STRUCT*)state_params->state;
+ }
+
+ /* See if to be acknowledged */
+ if (0x01 == req_type->to_be_acked)
+ {
+ CONSOLE_OUT("[GENERIC_ONOFF] Sending Response.\n");
+ /* Parameters: Request Context, Current State, Target State (NULL: to be ignored), Remaining Time (0: to be ignored), Additional Parameters (NULL: to be ignored) */
+ retval = MS_generic_onoff_server_state_update(ctx, ¤t_state_params, NULL, 0, NULL);
+ }
+
+ return retval;
+}
+
+static API_RESULT UI_register_generic_onoff_model_server
+(
+ MS_ACCESS_ELEMENT_HANDLE element_handle
+)
+{
+ /* Generic OnOff Server */
+ MS_ACCESS_MODEL_HANDLE UI_generic_onoff_server_model_handle;
+ API_RESULT retval;
+ CONSOLE_OUT("In Generic OnOff Model Server\n");
+ retval = MS_generic_onoff_server_init
+ (
+ element_handle,
+ &UI_generic_onoff_server_model_handle,
+ UI_generic_onoff_server_cb
+ );
+
+ if (API_SUCCESS == retval)
+ {
+ CONSOLE_OUT(
+ "Generic Onoff Server Initialized. Model Handle: 0x%04X\n",
+ UI_generic_onoff_server_model_handle);
+ }
+ else
+ {
+ CONSOLE_OUT(
+ "[ERR] Generic Onoff Server Initialization Failed. Result: 0x%04X\n",
+ retval);
+ }
+
+ return retval;
+}
+
+/* Provisionee */
+#define UI_PROV_OUTPUT_OOB_ACTIONS \
+ (PROV_MASK_OOOB_ACTION_BLINK | PROV_MASK_OOOB_ACTION_BEEP | \
+ PROV_MASK_OOOB_ACTION_VIBRATE | PROV_MASK_OOOB_ACTION_NUMERIC | \
+ PROV_MASK_OOOB_ACTION_ALPHANUMERIC)
+
+/** Output OOB Maximum size supported */
+#define UI_PROV_OUTPUT_OOB_SIZE 0x08
+
+/** Input OOB Actions supported */
+#define UI_PROV_INPUT_OOB_ACTIONS \
+ (PROV_MASK_IOOB_ACTION_PUSH | PROV_MASK_IOOB_ACTION_TWIST | \
+ PROV_MASK_IOOB_ACTION_NUMERIC | PROV_MASK_IOOB_ACTION_ALPHANUMERIC)
+
+/** Input OOB Maximum size supported */
+#define UI_PROV_INPUT_OOB_SIZE 0x08
+
+/** Beacon setup timeout in seconds */
+#define UI_PROV_SETUP_TIMEOUT_SECS 30
+
+/** Attention timeout for device in seconds */
+#define UI_PROV_DEVICE_ATTENTION_TIMEOUT 30
+
+#define PROV_AUTHVAL_SIZE_PL 16
+
+/** Authentication values for OOB Display - To be made random */
+#define UI_DISPLAY_AUTH_DIGIT 3
+#define UI_DISPLAY_AUTH_NUMERIC 35007
+#define UI_DISPLAY_AUTH_STRING "f00l"
+
+/** Provisioning capabilities of local device */
+DECL_STATIC PROV_CAPABILITIES_S UI_prov_capab =
+{
+ /** Number of Elements */
+ 0x01,
+
+ /** Supported algorithms */
+ PROV_MASK_ALGO_EC_FIPS_P256,
+
+ /** Public key type */
+ PROV_MASK_PUBKEY_OOBINFO,
+
+ /** Static OOB type */
+ PROV_MASK_STATIC_OOBINFO,
+
+ /** Output OOB information */
+ { UI_PROV_OUTPUT_OOB_ACTIONS, UI_PROV_OUTPUT_OOB_SIZE },
+
+ /** Input OOB information */
+ { UI_PROV_INPUT_OOB_ACTIONS, UI_PROV_INPUT_OOB_SIZE },
+};
+
+/** Unprovisioned device identifier */
+PROV_DEVICE_S UI_lprov_device =
+{
+ /** UUID */
+ {0xa8, 0x01, 0xb1, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0x00, 0x00, 0x00},
+
+ /** OOB Flag */
+ 0x00,
+
+ /**
+ Encoded URI Information
+ For example, to give a web address, "https://www.abc.com"
+ the URI encoded data would be -
+ 0x17 0x2F 0x2F 0x77 0x77 0x77 0x2E 0x61 0x62 0x63 0x2E 0x63 0x6F 0x6D
+ where 0x17 is the URI encoding for https:
+ */
+ NULL
+};
+
+/** Current role of application - Provisioner/Device */
+DECL_STATIC UCHAR UI_prov_role;
+
+/** Provisioning Handle */
+DECL_STATIC PROV_HANDLE UI_prov_handle;
+
+static API_RESULT UI_prov_callback
+(
+ PROV_HANDLE* phandle,
+ UCHAR event_type,
+ API_RESULT event_result,
+ void* event_data,
+ UINT16 event_datalen
+)
+{
+ PROV_DEVICE_S* rdev;
+ PROV_CAPABILITIES_S* rcap;
+ PROV_DATA_S* rdata;
+ PROV_OOB_TYPE_S* oob_info;
+ API_RESULT retval;
+ UCHAR i;
+ UCHAR authstr[PROV_AUTHVAL_SIZE_PL << 1];
+ UINT32 authnum;
+ UCHAR authtype;
+ UCHAR* pauth;
+ UINT16 authsize;
+ UCHAR pdata[(MS_DEVICE_UUID_SIZE * 2) + 1];
+ UCHAR* t_data;
+
+ switch (event_type)
+ {
+ case PROV_EVT_PROVISIONING_SETUP:
+ CONSOLE_OUT("Recvd PROV_EVT_PROVISIONING_SETUP\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+ /* Display the attention timeout */
+ CONSOLE_OUT("Attention TImeout - %d\n", *((UCHAR*)event_data));
+ break;
+
+ case PROV_EVT_OOB_DISPLAY:
+ CONSOLE_OUT("Recvd PROV_EVT_OOB_DISPLAY\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+ /* Reference the Authenticatio Type information */
+ oob_info = (PROV_OOB_TYPE_S*)event_data;
+ CONSOLE_OUT("Authenticaion Action - 0x%02X\n", oob_info->action);
+ CONSOLE_OUT("Authenticaion Size - 0x%02X\n", oob_info->size);
+
+ /* If role is Device, the action is of Output OOB, else Input OOB */
+ if (PROV_ROLE_DEVICE == UI_prov_role)
+ {
+ if (PROV_OOOB_ACTION_ALPHANUMERIC == oob_info->action)
+ {
+ authtype = 1;
+ }
+ else if (PROV_OOOB_ACTION_NUMERIC == oob_info->action)
+ {
+ authtype = 2;
+ }
+ else
+ {
+ authtype = 0;
+ }
+ }
+ else
+ {
+ if (PROV_IOOB_ACTION_ALPHANUMERIC == oob_info->action)
+ {
+ authtype = 1;
+ }
+ else if (PROV_IOOB_ACTION_NUMERIC == oob_info->action)
+ {
+ authtype = 2;
+ }
+ else
+ {
+ authtype = 0;
+ }
+ }
+
+ if (1 == authtype)
+ {
+ EM_str_copy (authstr, UI_DISPLAY_AUTH_STRING);
+ CONSOLE_OUT("\n\n>>> AuthVal - %s <<<\n\n", authstr);
+ pauth = authstr;
+ authsize = EM_str_len(authstr);
+ }
+ else if (2 == authtype)
+ {
+ authnum = (UINT32)UI_DISPLAY_AUTH_NUMERIC;
+ CONSOLE_OUT("\n\n>>> AuthVal - %d <<<\n\n", authnum);
+ pauth = (UCHAR*)&authnum;
+ authsize = sizeof(UINT32);
+ }
+ else
+ {
+ authnum = (UINT32)UI_DISPLAY_AUTH_DIGIT;
+ CONSOLE_OUT("\n\n>>> AuthVal - %d <<<\n\n", authnum);
+ pauth = (UCHAR*)&authnum;
+ authsize = sizeof(UINT32);
+ }
+
+ /* Call to input the oob */
+ CONSOLE_OUT("Setting the Authval...\n");
+ retval = MS_prov_set_authval(&UI_prov_handle, pauth, authsize);
+ CONSOLE_OUT("Retval - 0x%04X\n", retval);
+ break;
+
+ case PROV_EVT_OOB_ENTRY:
+ CONSOLE_OUT("Recvd PROV_EVT_OOB_ENTRY\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+ /* Reference the Authenticatio Type information */
+ oob_info = (PROV_OOB_TYPE_S*)event_data;
+ CONSOLE_OUT("Authenticaion Action - 0x%02X\n", oob_info->action);
+ CONSOLE_OUT("Authenticaion Size - 0x%02X\n", oob_info->size);
+ break;
+
+ case PROV_EVT_DEVINPUT_COMPLETE:
+ CONSOLE_OUT("Recvd PROV_EVT_DEVINPUT_COMPLETE\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+ break;
+
+ case PROV_EVT_PROVDATA_INFO:
+ CONSOLE_OUT("Recvd PROV_EVT_PROVDATA_INFO\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+ /* Reference the Provisioning Data */
+ rdata = (PROV_DATA_S*)event_data;
+ CONSOLE_OUT("NetKey : ");
+ appl_dump_bytes(rdata->netkey, PROV_KEY_NETKEY_SIZE);
+ CONSOLE_OUT("Key ID : 0x%04X\n", rdata->keyid);
+ CONSOLE_OUT("Flags : 0x%02X\n", rdata->flags);
+ CONSOLE_OUT("IVIndex : 0x%08X\n", rdata->ivindex);
+ CONSOLE_OUT("UAddr : 0x%04X\n", rdata->uaddr);
+ blebrr_scan_pl(FALSE); // HZF
+ /* Provide Provisioning Data to Access Layer */
+ MS_access_cm_set_prov_data
+ (
+ rdata
+ );
+ break;
+
+ case PROV_EVT_PROVISIONING_COMPLETE:
+ CONSOLE_OUT("Recvd PROV_EVT_PROVISIONING_COMPLETE\n");
+ CONSOLE_OUT("Status - 0x%04X\n", event_result);
+
+ if (API_SUCCESS == event_result)
+ {
+ /* Already Set while handling PROV_EVT_PROVDATA_INFO */
+ /* LED ON/OFF for Provisioning Indication Abstraction Call */
+ mesh_model_device_provisioned_ind_pl();
+ }
+
+ break;
+
+ default:
+ CONSOLE_OUT("Unknown Event - 0x%02X\n", event_type);
+ }
+
+ return API_SUCCESS;
+}
+
+static void UI_register_prov(void)
+{
+ API_RESULT retval;
+ CONSOLE_OUT("Registering with Provisioning layer...\n");
+ retval = MS_prov_register(&UI_prov_capab, UI_prov_callback);
+ CONSOLE_OUT("Retval - 0x%04X\n", retval);
+}
+
+static void UI_setup_prov(UCHAR role, UCHAR brr)
+{
+ API_RESULT retval;
+
+ if (PROV_ROLE_PROVISIONER != role)
+ {
+ CONSOLE_OUT("Setting up Device for Provisioning ...\n");
+ retval = MS_prov_setup
+ (
+ brr,
+ role,
+ &UI_lprov_device,
+ UI_PROV_SETUP_TIMEOUT_SECS
+ );
+ UI_prov_role = PROV_ROLE_DEVICE;
+ }
+ else
+ {
+ CONSOLE_OUT("Setting up Provisioner for Provisioning ...\n");
+ retval = MS_prov_setup
+ (
+ brr,
+ role,
+ NULL,
+ UI_PROV_SETUP_TIMEOUT_SECS
+ );
+ UI_prov_role = PROV_ROLE_PROVISIONER;
+ }
+
+ CONSOLE_OUT("Retval - 0x%04X\n", retval);
+}
+
+static void UI_prov_bind(UCHAR brr, UCHAR index)
+{
+ API_RESULT retval;
+ /* Call to bind with the selected device */
+ CONSOLE_OUT("Binding with the selected device...\n");
+ retval = MS_prov_bind(brr, &UI_lprov_device, UI_PROV_DEVICE_ATTENTION_TIMEOUT, &UI_prov_handle);
+ CONSOLE_OUT("Retval - 0x%04X\n", retval);
+}
+
+void appl_mesh_sample (void)
+{
+ MS_ACCESS_NODE_ID node_id;
+ MS_ACCESS_ELEMENT_DESC element;
+ MS_ACCESS_ELEMENT_HANDLE element_handle;
+ API_RESULT retval;
+ UCHAR role, brr;
+ MS_CONFIG* config_ptr;
+ #ifdef MS_HAVE_DYNAMIC_CONFIG
+ MS_CONFIG config;
+ /* Initialize dynamic configuration */
+ MS_INIT_CONFIG(config);
+ config_ptr = &config;
+ #else
+ config_ptr = NULL;
+ #endif /* MS_HAVE_DYNAMIC_CONFIG */
+ /* Initialize OSAL */
+ EM_os_init();
+ /* Initialize Debug Module */
+ EM_debug_init();
+ /* Initialize Timer Module */
+ EM_timer_init();
+ timer_em_init();
+ /* Initialize utilities */
+ nvsto_init();
+ /* Initialize Mesh Stack */
+ MS_init(config_ptr);
+ /* Register with underlying BLE stack */
+ blebrr_register();
+ /* Enable LED Port */
+ /* Platform Abstraction Initializations of GPIOs/LEDs etc. */
+ mesh_model_platform_init_pl();
+ /* LED ON */
+ /* LED ON/OFF for BOOT UP Indication Abstraction Call */
+ mesh_model_device_bootup_ind_pl();
+ /* Create Node */
+ retval = MS_access_create_node(&node_id);
+ /* Register Element */
+ /**
+ TBD: Define GATT Namespace Descriptions from
+ https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors
+
+ Using 'main' (0x0106) as Location temporarily.
+ */
+ element.loc = 0x0106;
+ retval = MS_access_register_element
+ (
+ node_id,
+ &element,
+ &element_handle
+ );
+
+ if (API_SUCCESS == retval)
+ {
+ /* Register foundation model servers */
+ retval = UI_register_foundation_model_servers(element_handle);
+ }
+
+ if (API_SUCCESS == retval)
+ {
+ /* Register Generic OnOff model server */
+ retval = UI_register_generic_onoff_model_server(element_handle);
+ }
+
+ if (API_SUCCESS == retval)
+ {
+ /* Initialize model states */
+ UI_model_states_initialization();
+ }
+
+ /* Configure as provisionee/device */
+ UI_register_prov();
+ /**
+ setup