From 9b086f8c4b5e96b46a3904c3bcfe11af39347b80 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 26 Jul 2015 22:56:49 +0200 Subject: o Adding three new characteristics: - Model number: Set to the board id. - Hardware revision: set to the device version data from the nRF8001 device. Not very useful right now. - Firmware revision: set to the string "Arduino: " + build time if not predefined from the outside. --- services_lock.h | 150 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 74 insertions(+), 76 deletions(-) (limited to 'services_lock.h') diff --git a/services_lock.h b/services_lock.h index df5ee8d..2d4e972 100644 --- a/services_lock.h +++ b/services_lock.h @@ -15,7 +15,7 @@ #define SETUP_ID 0 #define SETUP_FORMAT 3 /** nRF8001 D */ -#define ACI_DYNAMIC_DATA_SIZE 166 +#define ACI_DYNAMIC_DATA_SIZE 226 /* Service: Gap - Characteristic: Device name - Pipe: SET */ #define PIPE_GAP_DEVICE_NAME_SET 1 @@ -45,8 +45,20 @@ #define PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_SET 7 #define PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_SET_MAX_SIZE 5 +/* Service: Device Information - Characteristic: Model Number String - Pipe: SET */ +#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET 8 +#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET_MAX_SIZE 20 -#define NUMBER_OF_PIPES 7 +/* Service: Device Information - Characteristic: Hardware Revision String - Pipe: SET */ +#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET 9 +#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET_MAX_SIZE 9 + +/* Service: Device Information - Characteristic: Firmware Revision String - Pipe: SET */ +#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET 10 +#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET_MAX_SIZE 20 + + +#define NUMBER_OF_PIPES 10 #define SERVICES_PIPE_TYPE_MAPPING_CONTENT {\ {ACI_STORE_LOCAL, ACI_SET}, \ @@ -56,6 +68,9 @@ {ACI_STORE_LOCAL, ACI_RX_ACK_AUTO}, \ {ACI_STORE_LOCAL, ACI_TX}, \ {ACI_STORE_LOCAL, ACI_SET}, \ + {ACI_STORE_LOCAL, ACI_SET}, \ + {ACI_STORE_LOCAL, ACI_SET}, \ + {ACI_STORE_LOCAL, ACI_SET}, \ } #define GAP_PPCP_MAX_CONN_INT 0xffff /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */ @@ -63,73 +78,7 @@ #define GAP_PPCP_SLAVE_LATENCY 0 #define GAP_PPCP_CONN_TIMEOUT 0xffff /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */ -/** @brief do a set_local_data for PIPE_GAP_DEVICE_NAME_SET - * @param src source buffer to send data from - * @param size the number of bytes to send. Maximum size is 10 - * @details use this function to do a set_local_data for PIPE_GAP_DEVICE_NAME_SET. If no transaction are currently - * running, the set will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. - */ -void services_set_gap_device_name(void *src, int size); - -/** @brief do a set_local_data for PIPE_BATTERY_BATTERY_LEVEL_SET - * @param src the value to send - * @details use this function to do a set_local_data for PIPE_BATTERY_BATTERY_LEVEL_SET. If no transaction are currently - * running, the set will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. - */ -void services_set_battery_battery_level(uint8_t src); - -/** @brief send a new value for PIPE_SOIL_MOISTURE_SOIL_MOISTURE_CONTROL_TX - * @param src source buffer to send data from - * @param size the number of bytes to send. Maximum size is 20 - * @param is_freshest_sample set it to true if you want to overwrite an eventual pending transaction on this pipe. - * @details use this function to send a new value for PIPE_SOIL_MOISTURE_SOIL_MOISTURE_CONTROL_TX. If no transaction are currently - * running, the send will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. If a transaction on this pipe is already pending, then this function - * will not overwrite the data of the previous transaction and return false. - * @return : true if is_freshest_sample true, otherwise return false if a transaction on this pipe is already pending, true otherwise. - */ -bool services_send_soil_moisture_soil_moisture_control(void *src, int size, bool is_freshest_sample); - -/** @brief do a set_local_data for PIPE_SOIL_MOISTURE_SOIL_MOISTURE_CONTROL_SET - * @param src source buffer to send data from - * @param size the number of bytes to send. Maximum size is 20 - * @details use this function to do a set_local_data for PIPE_SOIL_MOISTURE_SOIL_MOISTURE_CONTROL_SET. If no transaction are currently - * running, the set will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. - */ -void services_set_soil_moisture_soil_moisture_control(void *src, int size); - -/** @brief send a new value for PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_TX - * @param src source buffer to send data from - * @param size the number of bytes to send. Maximum size is 5 - * @param is_freshest_sample set it to true if you want to overwrite an eventual pending transaction on this pipe. - * @details use this function to send a new value for PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_TX. If no transaction are currently - * running, the send will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. If a transaction on this pipe is already pending, then this function - * will not overwrite the data of the previous transaction and return false. - * @return : true if is_freshest_sample true, otherwise return false if a transaction on this pipe is already pending, true otherwise. - */ -bool services_send_soil_moisture_intermediate_temperature(void *src, int size, bool is_freshest_sample); - -/** @brief do a set_local_data for PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_SET - * @param src source buffer to send data from - * @param size the number of bytes to send. Maximum size is 5 - * @details use this function to do a set_local_data for PIPE_SOIL_MOISTURE_INTERMEDIATE_TEMPERATURE_SET. If no transaction are currently - * running, the set will be immediate, otherwise, it will be done at the end of the current transaction - * when services_update_pipes will be called. - */ -void services_set_soil_moisture_intermediate_temperature(void *src, int size); - -/** @brief function to trig pending transaction on pipes - * @details This function check for each pipe if it has a pending transaction (send/rx_request/ack) - * and if so executes this transaction. - * This function should be called in the APP_RUN state of the process function of the application. - */ -void services_update_pipes(void); - -#define NB_SETUP_MESSAGES 20 +#define NB_SETUP_MESSAGES 28 #define SETUP_MESSAGES_CONTENT {\ {0x00,\ {\ @@ -138,8 +87,8 @@ void services_update_pipes(void); },\ {0x00,\ {\ - 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x07,0x01,0x01,0x00,0x00,0x06,0x00,0x01,\ - 0xd1,0x0f,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ + 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0a,0x01,0x01,0x00,0x00,0x06,0x00,0x01,\ + 0x91,0x0f,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ },\ },\ {0x00,\ @@ -215,8 +164,50 @@ void services_update_pipes(void); },\ {0x00,\ {\ - 0x1e,0x06,0x20,0xfc,0x2a,0x16,0x04,0x06,0x05,0x00,0x11,0x2a,0x1e,0x01,0x00,0x00,0x00,0x00,0x00,0x46,\ - 0x14,0x03,0x02,0x00,0x12,0x29,0x02,0x01,0x00,0x00,0x00,\ + 0x1f,0x06,0x20,0xfc,0x2a,0x16,0x04,0x06,0x05,0x00,0x11,0x2a,0x1e,0x01,0x00,0x00,0x00,0x00,0x00,0x46,\ + 0x14,0x03,0x02,0x00,0x12,0x29,0x02,0x01,0x00,0x00,0x04,0x04,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0x18,0x02,0x02,0x00,0x13,0x28,0x00,0x01,0x0a,0x18,0x04,0x04,0x05,0x05,0x00,0x14,0x28,\ + 0x03,0x01,0x02,0x15,0x00,0x24,0x2a,0x04,0x04,0x14,0x00,0x00,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0x34,0x15,0x2a,0x24,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0x50,0x00,0x16,0x28,0x03,0x01,0x02,0x17,0x00,0x27,0x2a,0x04,0x04,0x09,0x00,0x00,0x17,\ + 0x2a,0x27,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0x6c,0x04,0x04,0x05,0x05,0x00,0x18,0x28,0x03,0x01,0x02,0x19,0x00,0x26,0x2a,0x04,0x04,\ + 0x14,0x00,0x00,0x19,0x2a,0x26,0x01,0x00,0x00,0x00,0x00,0x00,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,\ + 0x04,0x08,0x07,0x00,0x1a,0x29,0x04,0x01,0x19,0x00,0x00,0x00,\ + },\ + },\ + {0x00,\ + {\ + 0x1f,0x06,0x21,0xa4,0x01,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x1b,0x28,0x03,0x01,0x02,0x1c,0x00,0x29,\ + 0x2a,0x06,0x04,0x0b,0x0a,0x00,0x1c,0x2a,0x29,0x01,0x54,0x72,\ + },\ + },\ + {0x00,\ + {\ + 0x1c,0x06,0x21,0xc0,0x79,0x67,0x76,0x69,0x73,0x20,0x49,0x4f,0x06,0x04,0x08,0x07,0x00,0x1d,0x29,0x04,\ + 0x01,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,\ },\ },\ {0x00,\ @@ -227,7 +218,13 @@ void services_update_pipes(void); },\ {0x00,\ {\ - 0x0f,0x06,0x40,0x1c,0x00,0x0f,0x2a,0x1e,0x01,0x00,0x82,0x04,0x00,0x11,0x00,0x12,\ + 0x1f,0x06,0x40,0x1c,0x00,0x0f,0x2a,0x1e,0x01,0x00,0x82,0x04,0x00,0x11,0x00,0x12,0x2a,0x24,0x01,0x00,\ + 0x80,0x04,0x00,0x15,0x00,0x00,0x2a,0x27,0x01,0x00,0x80,0x04,\ + },\ + },\ + {0x00,\ + {\ + 0x11,0x06,0x40,0x38,0x00,0x17,0x00,0x00,0x2a,0x26,0x01,0x00,0x80,0x04,0x00,0x19,0x00,0x00,\ },\ },\ {0x00,\ @@ -237,12 +234,13 @@ void services_update_pipes(void); },\ {0x00,\ {\ - 0x0f,0x06,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ + 0x18,0x06,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ + 0x00,0x00,0x00,0x00,0x00,\ },\ },\ {0x00,\ {\ - 0x06,0x06,0xf0,0x00,0x83,0x26,0xaa,\ + 0x06,0x06,0xf0,0x00,0x83,0x8c,0xe1,\ },\ },\ } -- cgit v1.2.3