Go to the documentation of this file.
59 #include "custom_config.h"
67 #define PAWR_MAX_SENT_DATA_LEN 250
68 #define PAWR_SENT_DATA_LEN_OFFSET 0
69 #define PAWR_SENT_DATA_TYPE_OFFSET 1
71 #define ESLS_CONNECTION_MAX 10
72 #define ESL_ADDR_LEN 2
73 #define ESL_SESSION_KEY_LEN 16
75 #define AP_SYNC_KEY_MATERIAL_LEN (ESL_SESSION_KEY_LEN + ESL_IV_LEN)
76 #define ESL_RSP_KEY_MATERIAL_LEN (ESL_SESSION_KEY_LEN + ESL_IV_LEN)
77 #define ESL_CTL_PT_TLV_MIN_LEN 2
78 #define ESL_CTL_PT_TLV_MAX_LEN 17
79 #define ESL_MAX_VAL_LEN 512
81 #define ESL_ADDR_ESL_ID_BROAD_ADDR 0xFF
83 #define ESL_CTL_PT_SENSOR_DATA_MAX_LEN 15
84 #define ESL_VENDOR_DATA_MAX_LEN 15
86 #define esls_sensor_size00(x) x&0xFF, (x>>8)&0xFF
87 #define esls_sensor_size01(y) y&0xFF, (y>>8)&0xFF, (y>>16)&0xFF, (y>>24)&0xFF
89 #define GRP_ID_MSK(esl_addr) (esl_addr & 0x7F)
90 #define ESL_TLV_CMD_TAG(OPCODE) (OPCODE & 0xF)
91 #define ESL_TLV_CMD_LEN(OPCODE) ((OPCODE>>4) & 0xF)
92 #define ESL_VEND_TAG 0x0F
93 #define ESL_LED_INFOR_TYPE_RGB(x) (x & 0x3F)
94 #define ESL_LED_INFOR_TYPE_MON(y) ((y & 0x3F)|(0x40))
103 #define ESLS_CHAR_MANDATORY 0xE01FF
104 #define ESLS_CHAR_DISPLAY_INFOR_SUP 0x00600
105 #define ESLS_CHAR_IMAGE_INFOR_SUP 0x01800
106 #define ESLS_CHAR_SENSOR_INFOR_SUP 0x06000
107 #define ESLS_CHAR_LED_INFOR_SUP 0x18000
115 #define ESLS_CONFIG_ADDR_MASK 0x1
116 #define ESLS_CONFIG_SYNC_KEY_MASK 0x2
117 #define ESLS_CONFIG_RSP_KEY_MASK 0x4
118 #define ESLS_CONFIG_ABS_TIME_MASK 0x8
120 #define ESLS_CONFIG_COMPLETE_MASK (ESLS_CONFIG_ADDR_MASK|ESLS_CONFIG_SYNC_KEY_MASK|ESLS_CONFIG_RSP_KEY_MASK|ESLS_CONFIG_ABS_TIME_MASK)
282 uint16_t esls_display_width;
283 uint16_t esls_display_height;
284 uint8_t esls_display_type;
320 uint8_t session_key[16];
337 uint8_t color_green:2;
338 uint8_t color_blue:2;
339 uint8_t color_brightness:2;
342 uint8_t bit_off_period;
343 uint8_t bit_on_period;
348 uint16_t repeat_type:1;
349 uint16_t repeat_duration:15;
@ ESL_VENDOR_IMAGE_END_NTF
The ESL profile vendor command to notify image transport end.
@ ESL_RSP_ERR_CODE_IMPLAUSIBLE_ABS_TIM
The Absolute Time parameter value in the command is implausible.
@ ESL_CMD_OPCODE_UPDATE_COMP
The ESL Control Point characteristic command procedure is Update Complete.
Electronic Shelf Label Service event.
Electronic Shelf Label Service Init variable.
Electronic Shelf Label Service sync parameter format.
ESL_SYNC_STATE_T
Electronic Shelf Label Service state machine types.
uint8_t * display_arr_p
ESL Service display infor buffer.
@ ESL_RSP_ERR_CODE_INVALID_IMAGE_IDX
The Image_Index value was out of range.
@ ESL_DISP_TYPE_THREE_GRAY_SCALE
the display supported show the colors of three gray scale.
uint8_t * led_arr_p
ESL Service led infor buffer.
@ ESL_RSP_ERR_CODE_QUEUE_FULL
The ESL is temporarily unable to add a further timed command to the queue of pending commands¡ªthe qu...
@ ESL_VENDOR_IMAGE_START_RSP
The ESL profile vendor command to response start image transport.
ESL_STATE_T esls_get_state_machine(void)
Get Electronic Shelf Label state machine.
@ ESLS_EVT_READ_SENSOR_DATA
Electronic Shelf Label read sensor data command .
@ ESL_CMD_OPCODE_LED_CTL
The ESL Control Point characteristic command procedure is LED Control.
@ ESL_DISP_TYPE_SIXTEEN_GRAY_SCALE
the display supported show the colors of sixteen gray scale.
ESL_STATE_T
Electronic Shelf Label Service state machine types.
uint16_t esls_active_led_state_get(void)
Get Electronic Shelf Label Service active LED state state .
uint16_t esls_pending_led_update_state_get(void)
Get Electronic Shelf Label Service pengding LED state state .
@ ESLS_EVT_NO_NEED_PROC
Electronic Shelf Label event max value.
uint16_t target_id_len
ESL Service sync peer device target id length.
sdk_err_t(* esls_evt_handler_t)(esls_evt_t *p_evt)
Electronic Shelf Label Service event handler func define.
esls_nvds_cb_t esls_nvds_cb
Electronic Shelf Label Service NVDS callback func.
uint16_t esls_pending_led_update_state_set(bool flag)
Electronic Shelf Label Service pengding LED state set.
@ ESL_DISP_TYPE_RED_BLACK_WHITE
the display supported show the colors of red black white.
uint16_t esls_service_start_handle_get(void)
Provide the interface for other modules to obtain the esls service start handle .
The struct of broadcast address with broadcast type.
uint16_t sensor_arr_len
ESL Service sensor infor buffer len.
uint8_t max_image_idx
Electronic Shelf Label Service max image index.
esl_vendor_opcode_t
Values for The ESL Control Point characteristic vendor command procedure.
@ ESL_RSP_ERR_CODE_RETRY
The ESL is temporarily unable to give a full response (e.g., because the required sensor hardware was...
@ ESL_CMD_OPCODE_REFRESH_DISP
The ESL Control Point characteristic command procedure is Refresh Display.
@ ESL_RSP_OPCODE_VEND_TAG
Response data as specified by the vendor of the ESL.
sdk_err_t esls_user_payload_send(uint8_t conn_idx, uint8_t user_opcode, uint8_t *esl_payload, uint16_t esl_len)
Sent Electronic Shelf Label Service user data.
@ UPDATING_STATE
Electronic Shelf Label updating state of state machine .
uint8_t conn_idx
Index of connection.
@ ESL_DISP_TYPE_RED_YELLOW_BLACK_WHITE
the display supported show the colors of red yellow black white.
@ ESL_VENDOR_IMAGE_START_REQ
The ESL profile vendor command to request start image transport.
esl_cmd_opcode_t
Values for The ESL Control Point characteristic command procedure.
esls_evt_type_t evt_type
Electronic Shelf Label Service event type.
@ ESL_VENDOR_DATA_ERR_CKSUM
The ESL profile vendor data error is checksum fail.
void esls_service_reset(void)
Reset Electronic Shelf Label Service state and database.
@ SYNCHRONIZE_STATE
Electronic Shelf Label synchronized state of state machine .
@ ESLS_EVT_REFRESH_DISPLAY
Electronic Shelf Label refresh display.
@ ESL_DISP_TYPE_FULL_RGB
the display supported show the colors of full RGB.
ESL_SYNC_STATE_T sync_state
ESL Service state machine.
@ ESL_RSP_OPCODE_DISP_STATE
Acknowledgment of a request to display an image.
uint16_t esls_sync_to_ap_state_set(bool flag)
Electronic Shelf Label Service sync state set.
@ UNASSOCIAT_STATE
Electronic Shelf Label unassociated state of state machine .
uint16_t esls_service_need_state_get(void)
Get Electronic Shelf Label Service service need state .
esls_char_infor_t esls_char_infor
Electronic Shelf Label Service characteristic information.
@ ESL_RSP_ERR_CODE_RFU
Reserved for Future Use.
@ ESLS_EVT_CURRENT_ABS_TIM
Electronic Shelf Label set current absolute time command report to user.
@ ESL_RSP_OPCODE_SENSOR_TAG
Sensor report.
@ ESL_RSP_ERR_CODE_INSUFF_BATTERY
The request could not be processed because of a lack of battery charge.
@ ESL_RSP_ERR_CODE_INVALID_STATE
The request was not valid for the present ESL state.
@ ESLS_EVT_LED_TIMED_CTL
Electronic Shelf Label control LED, when the timer timeout.
sdk_err_t esls_service_init(esls_init_t *p_esls_init)
Init a Electronic Shelf Label Service instance and add in the DB.
uint8_t sync_idx
ESL Service sync index.
uint16_t esls_active_led_state_set(bool flag)
Electronic Shelf Label Service active LED state set.
esls_evt_handler_t evt_handler
Electronic Shelf Label Service event handler.
@ ESL_RSP_ERR_CODE_INVALID_OPCODE
The opcode was not recognized.
@ ESLS_EVT_UNASSOCIATE_FROM_AP
Electronic Shelf Label unassociate from AP command report to user.
@ ESL_DISP_TYPE_YELLOW_BLACK_WHITE
the display supported show the colors of yellow black white.
@ ESL_VENDOR_DATA_ERR_LEN
The ESL profile vendor data error is invalid-length .
@ ESL_RSP_OPCODE_LED_STATE
Acknowledgment of a request to control an LED.
@ ESL_CMD_OPCODE_PING
The ESL Control Point characteristic command procedure is ping.
uint16_t esls_pending_display_update_state_set(bool flag)
Electronic Shelf Label Service pengding display state set.
@ SYNC_STATE_IDLE
Electronic Shelf Label sync procedure is idle .
@ ESL_RSP_ERR_CODE_CAPACITY_LIMIT
The required response could not be sent as it would exceed the payload size limit.
@ ESL_CMD_OPCODE_DISP_TIM_IMAGE
The ESL Control Point characteristic command procedure is Display Timed Image.
ble_app_nvds_put_cb_t put_cb
The pointer of Electronic Shelf Label Service nvds put func.
@ ESLS_EVT_WRITE_VEND_COMMAND
Electronic Shelf Label vendor command procedure, esl_vendor_opcode_t.
@ ESL_RSP_ERR_CODE_VEND_BEGIN
Error codes defined by a vendor.
Electronic Shelf Label Service characteristic information.
@ SYNC_STATE_START
Electronic Shelf Label sync procedure is starting .
uint16_t esls_pending_display_update_state_get(void)
Get Electronic Shelf Label Service pengding display state state .
@ ESL_CMD_OPCODE_LED_TIM_CTL
The ESL Control Point characteristic command procedure is LED Timed Control.
@ ESL_CMD_OPCODE_UNASSOCIATE_AP
The ESL Control Point characteristic command procedure is Unassociate from AP.
@ ESL_VENDOR_REQ_BD_ADDR
The ESL profile vendor command to request peer device bd_addr.
ble_app_nvds_get_cb_t get_cb
The pointer of Electronic Shelf Label Service nvds get func.
@ ESL_RSP_OPCODE_BASIC_STATE
General acknowledgment containing ESL status data.
@ ESL_CMD_OPCODE_RD_SENSOR_DATA
The ESL Control Point characteristic command procedure is Read Sensor Data.
@ ESLS_EVT_NOTIFICATION_DISABLED
Electronic Shelf Label value notification has been disabled.
esls_tlv_format_t * tlv_data
Electronic Shelf Label Service tlv data format.
esl_rsp_opcode_t
The ESL Control Point characteristic response behavior.
uint16_t esls_service_need_state_set(bool flag)
Electronic Shelf Label Service service need state set.
@ ESL_DISP_TYPE_EIGHT_GRAY_SCALE
the display supported show the colors of eight gray scale.
@ ESL_RSP_ERR_CODE_INVALID_PARAM
The parameter value(s) or length did not match the opcode.
bool config_flag
ESL Service sync paramter config flag.
esls_evt_type_t
Electronic Shelf Label Service event types.
bool esls_service_nvds_load_flag_get(void)
Get Electronic Shelf Label Service nvds load flag.
@ ESL_CMD_OPCODE_SRV_RST
The ESL Control Point characteristic command procedure is Service Reset.
#define ESL_CTL_PT_TLV_MAX_LEN
The longest TLV length .
@ ESL_RSP_ERR_CODE_UNSPEC
Any error condition that is not covered by a specific error code below.
uint16_t sdk_err_t
SDK API result type.
@ ESLS_EVT_LED_CTL
Electronic Shelf Label control LED.
@ UNSYNCHRONIZE_STATE
Electronic Shelf Label unsynchronized state of state machine .
@ ESL_VENDOR_RSP_DEVICE_NAME
The ESL profile has received peer device name.
uint8_t * sensor_arr_p
ESL Service sensor infor buffer.
uint16_t led_arr_len
ESL Service led infor buffer len.
@ ESL_STATE_MAX
Electronic Shelf Label state machine max value.
bool(* app_dev_reset_cbk_t)(uint8_t conn_idx, bool factory_rst)
@ ESL_DISP_TYPE_FOUR_GRAY_SCALE
the display supported show the colors of four gray scale.
@ ESL_VENDOR_RSP_BD_ADDR
The ESL profile has received peer device bd_addr.
sdk_err_t esls_set_state_machine(ESL_STATE_T esl_state)
Set Electronic Shelf Label state machine.
@ ESL_CMD_OPCODE_DISP_IMAGE
The ESL Control Point characteristic command procedure is Display Image.
Electronic Shelf Label Service sensor information data.
@ ESL_RSP_ERR_CODE_INSUFF_RESOURCE
The request could not be processed because of a lack of resources.
esl_vendor_data_err_t
Values for contrl point vendor command data error code.
uint32_t char_mask
Mask of Supported characteristics, and configured with Characteristics Mask.
@ ESL_DISP_TYPE_SEVEN_COLOR
the display supported show the colors of seven color.
@ ESLS_EVT_NOTIFICATION_ENABLED
Electronic Shelf Label value notification has been enabled.
uint16_t esls_sync_to_ap_state_get(void)
Get Electronic Shelf Label Service sync state .
uint16_t display_arr_len
ESL Service display infor buffer len.
void ble_esls_evt_on_ble_capture(const ble_evt_t *p_evt)
Capture esl service events on BLE.
void * evt_data_ptr
Electronic Shelf Label Service raw data format.
@ ESLS_EVT_TX_DATA_SENT
The data from the application has been sent, and the service is ready to accept new data from the app...
sdk_err_t esls_led_state_send(uint8_t conn_idx, uint8_t led_idx)
a Electronic Shelf Label Service reponse of LED control command .
sdk_err_t esls_tlv_response_send(uint8_t conn_idx, uint8_t *rsp_data_p, uint16_t len)
Send response message to AP.
ble_app_nvds_del_cb_t del_cb
The pointer of Electronic Shelf Label Service nvds delete func.
uint8_t(* ble_app_nvds_del_cb_t)(uint8_t tag)
@ ESL_RSP_ERR_CODE_VEND_NO_ERR
Error codes defined by a vendor to represent no error.
sdk_err_t esls_display_state_send(uint8_t conn_idx, uint8_t display_idx, uint8_t image_idx)
Sent Electronic Shelf Label Service diaplay state.
@ ESL_RSP_OPCODE_ERR
The command could not be processed successfully.
@ ESLS_EVT_DISPLAY_TIMED_IMAGE
Electronic Shelf Label display Image, when the timer timeout.
@ ESLS_EVT_DISPLAY_IMAGE
Electronic Shelf Label display Image.
uint8_t(* ble_app_nvds_put_cb_t)(uint8_t tag, uint8_t len, uint8_t *p_buf)
uint8_t(* ble_app_nvds_get_cb_t)(uint8_t tag, uint8_t *p_len, uint8_t *p_buf)
Electronic Shelf Label Service NVDS callback func define.
sdk_err_t esls_err_state_send(uint8_t conn_idx, esl_rsp_err_code_t err_code)
a Electronic Shelf Label Service reponse AP with a Error code.
sdk_err_t esls_sync_past_param_set(esls_ap_sync_param_t *sync_past_ptr)
Set Electronic Shelf Label default per sync trans parameter.
Electronic Shelf Label Service NVDS callback func.
@ CONFIGURING_STATE
Electronic Shelf Label configuring state of state machine .
@ ESL_DISP_TYPE_SIXTEEN_COLOR
the display supported show the colors of sixteen color.
@ ESLS_EVT_FACTORY_RESET
Electronic Shelf Label factory reset command report to user.
sdk_err_t esls_base_state_send(uint8_t conn_idx)
Sent a Electronic Shelf Label Service base state.
ESL_DISP_TYPE_T
The value of the Display_Type field is from an enumeration , which identifies the colors that are sup...
@ ESL_DISP_TYPE_BLACK_WHITE
the display supported show the colors of black white.
ESLS_NVDS_PARAM_ID_T
Electronic Shelf Label Service List of NVDS parameters identifiers.
@ ESL_VENDOR_DATA_NO_ERR
The ESL profile vendor data no error.
esl_rsp_err_code_t
The Error response has a single parameter that contains an error code .
@ ESL_VENDOR_REQ_DEVICE_NAME
The ESL profile vendor command to request peer device name.
@ ESL_CMD_OPCODE_FACTORY_RST
The ESL Control Point characteristic command procedure is Factory Reset.
@ ESL_RSP_ERR_CODE_IMAGE_NOT_AVAILABLE
The requested image contained no image data.
@ ESL_RSP_ERR_CODE_MAX
Error codes defined MAX.
sdk_err_t esls_user_payload_prepare(uint8_t *esl_sent_buffer, uint16_t *esl_sent_buffer_offset, uint8_t user_opcode, uint8_t *esl_payload, uint16_t esl_len)
Set Electronic Shelf Label Service user data in esl_sent_buffer, will sent later.
uint16_t sync_to
ESL Service sync timeout.
sdk_err_t esls_sensor_value_send(uint8_t conn_idx, uint8_t sensor_idx, uint8_t *sensor_data_p, uint8_t len)
Sent Electronic Shelf Label Service sensor data.
ble_gap_bdaddr_t target_addr
ESL Service sync peer device bd addr.
Electronic Shelf Label Service display information data.
Electronic Shelf Label Service led information data.
@ SYNC_STATE_ACTIVE
Electronic Shelf Label sync procedure is running .
@ ESLS_EVT_SERVICE_RESET
Electronic Shelf Label service reset command report to user.
@ PARAM_ID_ESL_CONFIG_INFOR
Definition of the tag associated to each parameters Service config information tag id.