Chapter 2. API Reference
(continued from previous page)
/* Config for protocomm_ble_start() */
protocomm_ble_config_t config = {
.service_uuid = {
/* LSB <---------------------------------------
* ---------------------------------------> MSB */
0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
},
.nu_lookup_count = sizeof(nu_lookup_table)/sizeof(nu_lookup_
,→table[0]),
.nu_lookup = nu_lookup_table
};
/* Start protocomm layer on top of BLE */
protocomm_ble_start(pc, &config);
/* For protocomm_security0, Proof of Possession is not used, and can␣
,→be kept NULL */
protocomm_set_security(pc, "security_endpoint", &protocomm_security0,␣
,→NULL);
protocomm_add_endpoint(pc, "echo_req_endpoint", echo_req_handler,␣
,→NULL);
return pc;
}
/* Example function for stopping a protocomm instance */
void stop_pc(protocomm_t *pc)
{
protocomm_remove_endpoint(pc, "echo_req_endpoint");
protocomm_unset_security(pc, "security_endpoint");
/* Stop BLE protocomm service */
protocomm_ble_stop(pc);
protocomm_delete(pc);
}
API Reference
Header File
• components/protocomm/include/common/protocomm.h
Functions
protocomm_t *protocomm_new(void)
Create a new protocomm instance.
This API will return a new dynamically allocated protocomm instance with all elements of the protocomm_t
structure initialized to NULL.
Return
• protocomm_t* : On success
• NULL : No memory for allocating new instance
void protocomm_delete(protocomm_t *pc)
Delete a protocomm instance.
This API will deallocate a protocomm instance that was created using protocomm_new().
Parameters
Espressif Systems 667
Submit Document Feedback
Release v4.4