bt_gatt_client_init()

bt_gatt_client_init()

Description

Initializes GATT client interface.

Syntax

bt_gatt_client_init();

Parameters

This function has no parameters.

Returns

Return value

Return explanation

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Successfully initialized GATT client interface.

SCRIPT_OPERATION_FAILED

Failed to initialize communication with Bluetooth.

SCRIPT_NO_ACCESS

Bluetooth GATT client already 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(); for(;;) { Delay(100); } }

 

Debug example

This example initializes BLE and then 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"); } for(;;) { Delay(1000); } }