SWRU580 April 2021 CC2564C , CC2564MODA , CC2564MODN
Description
The following function is responsible for displaying the information of all Current connected devices. This function will return zero on successful execution.
Parameters
This command requires can work in two options.
Option 1, zero parameters or the parameter 0, this option will display only the connected devices.
option 2, the parameter one, this option will display a list of all the stored devices.
Command Call Examples
“ConnectedDevices” Attempts to display only the connected devices.
“ConnectedDevices 0 ” Attempts to display only the connected devices.
“ConnectedDevices 1 ” Attempts to display a list of all the stored devices.
Possible Return Values
(0) Success.
Description
The following function is responsible for registering a SPPDMMULTI Service. This function will return zero on successful execution and a negative value on errors.
Parameters
It is not necessary to include parameters when using this command. A parameter will have no effect on the outcome of registering a SPPDMMULTI Service.
Possible Return Values
(0) Successfully registered a SPPDMMULTI Service.
(-4) Function Error (on failure).
(-103) BTPS_ERROR_FEATURE_NOT_AVAILABLE.
(-1000) BTGATT_ERROR_INVALID_PARAMETER.
(-1001) BTGATT_ERROR_NOT_INITIALIZED.
(-1004) BTGATT_ERROR_INVALID_BLUETOOTH_STACK_ID.
(-1005) BTGATT_ERROR_INSUFFICIENT_RESOURCES.
(-1011) BTGATT_ERROR_INVALID_SERVICE_TABLE_FORMAT.
(-1013) BTGATT_ERROR_INSUFFICIENT_HANDLES.
API Call
GATT_Register_Service(BluetoothStackID, SPPDMMULTI_SERVICE_FLAGS, SPPDMMULTI_SERVICE_ATTRIBUTE_COUNT, (GATT_Service_Attribute_Entry_t *)SPPDMMULTI_Service, &ServiceHandleGroup, GATT_ServerEventCallback, 0)
API Prototype
int BTPSAPI GATT_Register_Service(unsigned int BluetoothStackID, Byte_t ServiceFlags, unsigned int NumberOfServiceAttributeEntries, GATT_Service_Attribute_Entry_t *ServiceTable, GATT_Attribute_Handle_Group_t *ServiceHandleGroupResult, GATT_Server_Event_Callback_t ServerEventCallback, unsigned long CallbackParameter)
Description of API
The following function is provided to allow a means to add a GATT Service to the local GATT Database. The first parameter is Bluetooth stack ID of the Bluetooth Device. The second parameter is a bit mask field that specifies the type of service being registered, which must be non-zero (i.e. at least one bit must be set). The third parameter is the number of entries in the service attribute array that is pointed to by the fourth parameter. The fourth parameter is an array that contains the attributes for the service being registered. The next parameter is a pointer to a buffer that will store the attribute handle range of the registered service. The final two parameters specify the GATT server callback and callback parameter that will be used whenever a client request to the GATT server cannot be satisified internally by the local GATT module. This function will return a positive non-zero service ID if successful, or a negative return error code if there was an error. If this function returns success then the ServiceHandleGroupResult buffer will contain the service's attribute handle range.
Description
The following function is responsible for performing the Service Discovery Operation. The User can Discover the following options:
SPPDMMULTI, SPPLE or discover all the 16/32/128 bit UUID's from The Peer device. This function will return zero on successful execution and a negative value on errors.
Parameters
This command requires at least two parameters.
At least two parameter when using as the first parameter the Bluetooth Address of the remote device that is connected, the second parameters is the UUID type.
Or three parameters when the first parameter is the connection ID of the connection with the remote device, the second parameters is the UUID type,the third parameter is 1 and it is mandatory.
The UUID type can be: 1 - SPPDMMulti, 2 - SPPLE, 16/32/128 - 16/32/128 bit UUIDs
Command Call Examples
DiscoverLEService 001bdc05b617 0” Attempts to discover SPPDMMULTI services of the Bluetooth Device with the BD_ADDR of 001bdc05b617.
DiscoverLEService 000275e126FF 1 0” Attempts to discover SPPLE services of the Bluetooth Device with the BD_ADDR of 000275e126FF.
DiscoverLEService 2 0 1” Attempts to discover SPPDMMULTI services of the connection with the connection id of 2.
DiscoverLEService 1 32 1” Attempts to discover 32bit UUID's services of the connection with the connection id of 1.
Possible Return Values
(0) Successfully started a SPP LE Service Discovery.
(-4) Function Error (on failure).
(-6) INVALID_PARAMETERS_ERROR.
(-8) INVALID_STACK_ID_ERROR.
(-103) BTPS_ERROR_FEATURE_NOT_AVAILABLE.
(-1000) BTGATT_ERROR_INVALID_PARAMETER.
(-1005) BTGATT_ERROR_INSUFFICIENT_RESOURCES.
(-1010) BTGATT_ERROR_OUTSTANDING_REQUEST_EXISTS.
API Call
GATT_Start_Service_Discovery(BluetoothStackID, DeviceInfo->LEContextInfo.ConnectionID, (General_Discovery)?0:(sizeof(UUID)/sizeof(GATT_UUID_t)), (General_Discovery)?NULL:UUID, GATT_Service_Discovery_Event_Callback, DiscoveryType)
API Prototype
int BTPSAPI GATT_Start_Service_Discovery(unsigned int BluetoothStackID, unsigned int ConnectionID, unsigned int NumberOfUUID, GATT_UUID_t *UUIDList, GATT_Service_Discovery_Event_Callback_t ServiceDiscoveryCallback, unsigned long CallbackParameter)
Description of API
The following function is used to initiate a GATT Service Discovery process to the specified GATT connection. The function takes as its first parameter the BluetoothStackID that is associated with the Bluetooth Device. The second parameter is the Connection ID of the remote device that is to be searched. The third and fourth parameters specify an optional list of UUIDs to search for. The final two parameters define the Callback function and parameter to use when the service discovery is complete. The function returns zero on success and a negative return value if there was an error.
Description
The following function is responsible to configure a SPPDMMULTI Service on a remote device. This function will return zero on successful execution and a negative value on errors. The following function enables notifications of the proper characteristics based on a specified handle; depending what the device role for SPPDMMULTI is, server or client, the API function that is called is either a GATT_Handle_Value_Notification or a GATT_Write_Without_Response_Request; which notifies the receiving credit characteristic or sends a write with out response packet to the transmission credit characteristic respectively.
Parameters
This command requires at least one parameter.
At least one parameter when using as the first parameter the Bluetooth Address of the remote device that is connected, the second parameters in this option is 0 and optional.
Or two parameters when the first parameter is the connection ID of the connection with the remote device, the second parameter is 1 and it is mandatory.
Command Call Examples
“ConfigureSPPDMMULTI 001bdc05b617” Attempts to configure services of the Bluetooth Device with the BD_ADDR of 001bdc05b617.
“ConfigureSPPDMMULTI 000275e126FF 0” Attempts to configure services of the Bluetooth Device with the BD_ADDR of 000275e126FF.
“ConfigureSPPDMMULTI 1 1” Attempts to configure services of the connection with the connection id of 1.
Possible Return Values
(0) Successfully configured a SPPDMMULTI Service.
(-4) Function Error (on failure).
(-6) INVALID_PARAMETERS_ERROR.
(-8) INVALID_STACK_ID_ERROR.
(-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID.
(-26) BTPS_ERROR_L2CAP_NOT_INITIALIZED.
(-37) BTPS_ERROR_CHANNEL_NOT_IN_OPEN_STATE.
(-38) BTPS_ERROR_INVALID_CID.
(-41) BTPS_ERROR_NEGOTIATED_MTU_EXCEEDED.
(-47) BTPS_ERROR_INVALID_CID_TYPE.
(-65) BTPS_ERROR_INSUFFICIENT_BUFFER_SPACE.
(-98) BTPS_ERROR_DEVICE_NOT_CONNECTED.
(-1000) BTGATT_ERROR_INVALID_PARAMETER.
(-1001) BTGATT_ERROR_NOT_INITIALIZED.
(-1004) BTGATT_ERROR_INVALID_BLUETOOTH_STACK_ID.
(-1005) BTGATT_ERROR_INSUFFICIENT_RESOURCES.
(-1009) BTGATT_ERROR_INVALID_CONNECTION_ID.
API Call
GATT_Write_Request(BluetoothStackID, ConnectionID, ClientConfigurationHandle, sizeof(Buffer), &Buffer, ClientEventCallback, 0)
GATT_Handle_Value_Notification(BluetoothStackID, SPPDMMULTIServiceID, ConnectionID, SPPDMMULTI_RX_CREDITS_CHARACTERISTIC_ATTRIBUTE_OFFSET, WORD_SIZE, (Byte_t *)&Credits)
GATT_Write_Without_Response_Request(BluetoothStackID, ConnectionID, DeviceInfo->ClientInfo.Tx_Credit_Characteristic, WORD_SIZE, &Credits)
API Prototype
int BTPSAPI GATT_Write_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void *AttributeValue, GATT_Client_Event_Callback_t ClientEventCallback, unsigned long CallbackParameter)
int BTPSAPI GATT_Handle_Value_Notification(unsigned int BluetoothStackID, unsigned int ServiceID, unsigned int ConnectionID, Word_t AttributeOffset, Word_t AttributeValueLength, Byte_t *AttributeValue)
int BTPSAPI GATT_Write_Without_Response_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void *AttributeValue)
Description of API
The first of these API functions is provided to allow a means of performing a write request to a remote device for a specified attribute. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write the value of, followed by the length of the value (in bytes), followed by the the actual value data to write. The final two parameters specify the GATT client event callback function and callback parameter (respectively) that will be called when a response is received from the remote device. This function will return the positive, non-zero, Transaction ID of the request or a negative error code.
The second of these API functions allows a means of sending a Handle/Value notification to a remote GATT client. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack. The second parameter is the service ID of the service that is sending the Handle/Value notification. The third parameter specifies the connection ID of the connection to send the Handle/Value notification to. The fourth parameter specifies the offset in the service table (registered via the call to the GATT_Register_Service() function) of the attribute that is being notified. The fifth parameter is the length (in bytes) of the attribute value that is being notified. The sixth parameter is a pointer to the actual attribute value to notify. This function will return a non-negative value that represents the actual length of the attribute value that was notified, or a negative return error code if there was an error.
The third of these API functions is provided to allow a means of performing a write without response request to remote device for a specified attribute. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write, followed by the length of the value data to write (in bytes), followed by the actual value to write. This function will return the number of bytes written on success or a negative error code.
Description
The following function is responsible for sending a number of characters to a remote device to which a connection exists. The function receives a parameter that indicates the number of byte to be transferred. This function will return zero on successful execution and a negative value on errors. Depending what the device role for SPPDMMULTI is, server or client, the API function that is called is either a GATT_Handle_Value_Notification or a GATT_Write_Without_Response_Request; which notifies the receiving credit characteristic or sends a write with out response packet to the transmission credit characteristic respectively.
Parameters
This command requires at least two parameters.
At least two parameters when using as the first is the remote Bluetooth address of the device you are sending to. The second is the number of bytes to send. This value has to be greater than 10. The third parameter in this option is 0 and optional.
Or three parameters when the first parameter is the connection ID of the connection with the remote device you are sending to. The second is the number of bytes to send. This value has to be greater than 10. The third parameter is 1 and it is mandatory.
Command Call Examples
"LeSend 0017E7FEFD7C 100" Attempts to send 100 bytes of data to 0017E7FEFD7C.
"LeSend B8FFFEAF1CAD 25 0" Attempts to send 25 bytes of data to B8FFFEAF1CAD.
"LeSend 1 25 1" Attempts to send 25 bytes of data to the remote device with that is connected on connection ID 1.
Possible Return Values
(0) Successfully Sent Data.
(-4) FUNCTION_ERROR.
(-6) INVALID_PARAMETERS_ERROR.
(-8) INVALID_STACK_ID_ERROR.
API Call
GATT_Handle_Value_Notification(BluetoothStackID, SPPDMMULTIServiceID, ConnectionID, SPPDMMULTI_TX_CHARACTERISTIC_ATTRIBUTE_OFFSET, (Word_t)DataCount, SPPDMMULTIBuffer)
GATT_Write_Without_Response_Request(BluetoothStackID, ConnectionID, DeviceInfo->ClientInfo.Rx_Characteristic, (Word_t)DataCount, SPPDMMULTIBuffer)
API Prototype
int BTPSAPI GATT_Handle_Value_Notification(unsigned int BluetoothStackID, unsigned int ServiceID, unsigned int ConnectionID, Word_t AttributeOffset, Word_t AttributeValueLength, Byte_t *AttributeValue)
int BTPSAPI GATT_Write_Without_Response_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void *AttributeValue)
Description of API
The first of these API functions allows a means of sending a Handle/Value notification to a remote GATT client. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack. The second parameter is the service ID of the service that is sending the Handle/Value notification. The third parameter specifies the connection ID of the connection to send the Handle/Value notification to. The fourth parameter specifies the offset in the service table (registered via the call to the GATT_Register_Service() function) of the attribute that is being notified. The fifth parameter is the length (in bytes) of the attribute value that is being notified. The sixth parameter is a pointer to the actual attribute value to notify. This function will return a non-negative value that represents the actual length of the attribute value that was notified, or a negative return error code if there was an error.
The second of these API functions is provided to allow a means of performing a write without response request to remote device for a specified attribute. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write, followed by the length of the value data to write (in bytes), followed by the actual value to write. This function will return the number of bytes written on success or a negative error code.
Description
The following function is responsible for reading data sent by a remote device to which a connection exists. This function will return zero on successful execution and a negative value on errors. Depending what the device role for SPPDMMULTI is, server or client, the API function that is called is either a GATT_Handle_Value_Notification or a GATT_Write_Without_Response_Request; which notifies the receiving credit characteristic or sends a write with out response packet to the transmission credit characteristic respectively.
Parameters
This command requires at least one parameter.
At least one parameters when using as the first is the remote Bluetooth address of the device you are reading from. The second parameter in this option is 0 and optional.
Or two parameters when the first parameter is the connection ID of the connection with the remote device you are reading from. The second parameter is 1 and it is mandatory.
Command Call Examples
“LeRead 001bdc05b617” Attempts to read data of the Bluetooth Device with the BD_ADDR of 001bdc05b617.
“LeRead 000275e126FF 0” Attempts to read data of the Bluetooth Device with the BD_ADDR of 000275e126FF.
“LeRead 1 1” Attempts to read data of the remote device is connected on connection ID 1.
Possible Return Values
(0) Successfully Read Data.
(-6) INVALID_PARAMETERS_ERROR.
API Call
GATT_Handle_Value_Notification(BluetoothStackID, SPPDMMULTIServiceID, ConnectionID, SPPDMMULTI_RX_CREDITS_CHARACTERISTIC_ATTRIBUTE_OFFSET, WORD_SIZE, (Byte_t *)&Credits)
GATT_Write_Without_Response_Request(BluetoothStackID, ConnectionID, DeviceInfo->ClientInfo.Tx_Credit_Characteristic, WORD_SIZE, &Credits)
API Prototype
int BTPSAPI GATT_Handle_Value_Notification(unsigned int BluetoothStackID, unsigned int ServiceID, unsigned int ConnectionID, Word_t AttributeOffset, Word_t AttributeValueLength, Byte_t *AttributeValue)
int BTPSAPI GATT_Write_Without_Response_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void *AttributeValue)
Description of API
The first of these API functions allows a means of sending a Handle/Value notification to a remote GATT client. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack. The second parameter is the service ID of the service that is sending the Handle/Value notification. The third parameter specifies the connection ID of the connection to send the Handle/Value notification to. The fourth parameter specifies the offset in the service table (registered via the call to the GATT_Register_Service() function) of the attribute that is being notified. The fifth parameter is the length (in bytes) of the attribute value that is being notified. The sixth parameter is a pointer to the actual attribute value to notify. This function will return a non-negative value that represents the actual length of the attribute value that was notified, or a negative return error code if there was an error.
The second of these API functions is provided to allow a means of performing a write without response request to remote device for a specified attribute. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write, followed by the length of the value data to write (in bytes), followed by the actual value to write. This function will return the number of bytes written on success or a negative error code.
Description
The Loopback command is responsible for setting the application state to support loopback mode. This command will return zero on successful execution and a negative value on errors.
Parameters
This command requires one parameter which indicates if loopback should be supported. 0 = loopback not active, 1 = loopback active.
Command Call Examples
"Loopback 0" sets loopback support to inactive.
"loopback 1" sets loopback support to active.
Possible Return Values
(0) Successfully set loopback support.
(-6) INVALID_PARAMETERS_ERROR.
Description
The following function is responsible for setting the application state to support displaying Raw Data. This function will return zero on successful execution and a negative value on errors.
Parameters
This command accepts one parameter which indicates if displaying raw data mode should be supported. 0 = Display Raw Data Mode inactive, 1 = Display Raw Data active.
Command Call Examples
"DisplayRawModeData 0" sets Display Raw Mode support inactive.
"DisplayRawModeData 1" sets Display Raw Mode support active.
Possible Return Values
(0) Successfully sets Display Raw Data Mode support.
(-6) INVALID_PARAMETERS_ERROR.
Description
The AutomaticReadMode command is responsible for setting the application state to support Automatically reading all data that is received through SPP. This function will return zero on successful execution and a negative value on errors.
Parameters
This command accepts one parameter which indicates if automatic read mode should be supported. 0 = Automatic Read Mode inactive, 1 = Automatic Read Mode active.
Command Call Examples
"AutomaticReadMode 0" sets Automatic Read Mode support to inactive.
"AutomaticReadMode 1" sets Automatic Read Mode support to active.
Possible Return Values
(0) Successfully set Automatic Read Mode support.
(-6) INVALID_PARAMETERS_ERROR.