bt_gatt_client_deinit()
Description
Deinitializes GATT client interface.
Syntax
bt_gatt_client_deinit();
Parameters
This function has no parameters.
Returns
Return value | Return explanation |
|---|---|
SCRIPT_OPERATION_SUCCESS | Successfully deinitialized GATT client. |
SCRIPT_OPERATION_FAILED | Failed to deinitialize GATT client. |
SCRIPT_NO_ACCESS | GATT client is not initialized. |
Function call example
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#include <bluetooth>
main()
{
bt_init();
bt_gatt_client_init();
bt_gatt_client_deinit();
for(;;)
{
Delay(1000);
}
}
Debug example
This example initializes BLE, initializes GATT Client module and de-initializes GATT Client module. Example uses debug_print function to print information log to Initialized peripheral.
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#include <bluetooth>
#include <debug>
#define RS232_SPEED 115200
#define WORD_LENGTH WORDLENGTH_8
#define STOP_BITS STOPBITS_1
#define PARITY PARITY_NONE
new return_code = SCRIPT_OPERATION_SUCCESS;
main()
{
Init(RS232, RS232_SPEED, WORD_LENGTH, STOP_BITS, PARITY);
debug_init(RS232);
return_code = bt_init();
if (return_code != SCRIPT_OPERATION_SUCCESS)
{
// Handle failed bt_init here
debug_print("bt_init failed\r\n");
}
else
{
debug_print("bt_init succeeded\r\n");
}
return_code = bt_gatt_client_init();
if (return_code != SCRIPT_OPERATION_SUCCESS)
{
// Handle failed bt_gatt_client_init here
debug_print("bt_gatt_client_init failed\r\n");
}
else
{
debug_print("bt_gatt_client_init succeeded\r\n");
}
return_code = bt_gatt_client_deinit();
if (return_code != SCRIPT_OPERATION_SUCCESS)
{
// Handle failed bt_gatt_client_deinit here
debug_print("bt_gatt_client_deinit failed\r\n");
}
else
{
debug_print("bt_gatt_client_deinit succeeded\r\n");
}
for(;;)
{
Delay(1000);
}
}