nRF51 SDK: Command Decoder

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Functions
Command Decoder
BLE Serialization Libraries

Decoder for serialized commands from Application Chip. More...

## Macros

#define | RPC_DECODER_LENGTH_CHECK(LEN, INDEX, CMD)

## Functions

uint32_t | ble_rpc_cmd_resp_send (uint8_t op_code, uint32_t status)
| Function for sending a Command Response packet to the Application Chip through the transport layer. More...
uint32_t | ble_rpc_cmd_resp_data_send (uint8_t op_code, uint8_t status, const uint8_t *const p_data, uint16_t data_len)
| Function for sending a command response with additional data to the Application Chip through the transport layer. More...
void | ble_rpc_cmd_handle (void *p_event_data, uint16_t event_size)
| Function for scheduling an RPC command event to be processed in main-thread. More...

## Detailed Description

Decoder for serialized commands from Application Chip.

This file contains declaration of common functions used for sending responses back to Application Chip after the command is processed, and function for processing commands received by the transport layer.

## Macro Definition Documentation

#define RPC_DECODER_LENGTH_CHECK | ( |  | LEN,
|  |  | INDEX,
|  |  | CMD
| ) |  |

Value:
if ( INDEX > LEN) \
return ble_rpc_cmd_resp_send(CMD, NRF_ERROR_INVALID_LENGTH);

## Function Documentation

void ble_rpc_cmd_handle | ( | void * | p_event_data,
|  | uint16_t | event_size
| ) |  |

Function for scheduling an RPC command event to be processed in main-thread.

The function will read the arrived packet from the transport layer which is passed for decoding by the rpc_cmd_decoder module.

Parameters

  [in] | p_event_data | Event data. This will be NULL as rpc_evt_schedule does not set any data.
  [in] | event_size | Event data size. This will be 0 as rpc_evt_schedule does not set any data.

uint32_t ble_rpc_cmd_resp_data_send | ( | uint8_t | op_code,
|  | uint8_t | status,
|  | const uint8_t *const | p_data,
|  | uint16_t | data_len
| ) |  |

Function for sending a command response with additional data to the Application Chip through the transport layer.

Parameters

  [in] | op_code | The op code of the command for which the Command Response is sent.
  [in] | status | The status field to be encoded into the Command Response.
  [in] | p_data | The data to be sent along with the status.
  [in] | data_len | The length of the additional data.

Return values

  NRF_SUCCESS | On successful write of Command Response, otherwise an error code. If the transport layer returns an error code while sending the Command Response, the same error code will be returned by this function (see hci_transport_pkt_write for the list of error codes).

uint32_t ble_rpc_cmd_resp_send | ( | uint8_t | op_code,
|  | uint32_t | status
| ) |  |

Function for sending a Command Response packet to the Application Chip through the transport layer.

Parameters

  [in] | op_code | The op code of the command for which the Command Response is sent.
  [in] | status | The status field to be encoded into the Command Response.

Return values

  NRF_SUCCESS | On successful write of Command Response, otherwise an error code. If the transport layer returns an error code while sending the Command Response, the same error code will be returned by this function (see hci_transport_pkt_write for the list of error codes).