BLE temperature profile using digital DS1820 or analog LM35 sensors

Dependencies:   DS1820

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_rpc_cmd_decoder.h Source File

ble_rpc_cmd_decoder.h

Go to the documentation of this file.
00001 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 /** @file
00014  *
00015  * @defgroup ble_rpc_cmd_decoder Command Decoder
00016  * @{
00017  * @ingroup ble_sdk_lib_serialization
00018  *
00019  * @brief   Decoder for serialized commands from Application Chip.
00020  *
00021  * @details This file contains declaration of common functions used for sending responses back to
00022  *          Application Chip after the command is processed, and function for processing commands
00023  *          received by the transport layer.
00024  */
00025 
00026 #ifndef BLE_RPC_CMD_DECODER_H__
00027 #define BLE_RPC_CMD_DECODER_H__
00028 
00029 #include <stdint.h>
00030 
00031 #define RPC_DECODER_LENGTH_CHECK(LEN, INDEX, CMD) if ( INDEX > LEN) \
00032         return ble_rpc_cmd_resp_send(CMD, NRF_ERROR_INVALID_LENGTH);
00033 
00034 /**@brief Function for sending a Command Response packet to the Application Chip through the transport
00035  *        layer.
00036  *
00037  * @param[in] op_code          The op code of the command for which the Command Response is sent.
00038  * @param[in] status           The status field to be encoded into the Command Response.
00039  *
00040  * @retval NRF_SUCCESS         On successful write of Command Response, otherwise an error code.
00041  *                             If the transport layer returns an error code while sending
00042  *                             the Command Response, the same error code will be returned by this
00043  *                             function (see @ref hci_transport_pkt_write for the list of
00044  *                             error codes).
00045  */
00046 uint32_t ble_rpc_cmd_resp_send(uint8_t op_code, uint32_t status);
00047 
00048 /**@brief Function for sending a command response with additional data to the Application Chip through
00049  *        the transport layer.
00050  *
00051  * @param[in]   op_code        The op code of the command for which the Command Response is sent.
00052  * @param[in]   status         The status field to be encoded into the Command Response.
00053  * @param[in]   p_data         The data to be sent along with the status.
00054  * @param[in]   data_len       The length of the additional data.
00055  *
00056  * @retval      NRF_SUCCESS    On successful write of Command Response, otherwise an error code.
00057  *                             If the transport layer returns an error code while sending
00058  *                             the Command Response, the same error code will be returned by this
00059  *                             function (see @ref hci_transport_pkt_write for the list of
00060  *                             error codes).
00061  */
00062 uint32_t ble_rpc_cmd_resp_data_send(uint8_t               op_code,
00063                                     uint8_t               status,
00064                                     const uint8_t * const p_data,
00065                                     uint16_t              data_len);
00066 
00067 /**@brief Function for scheduling an RPC command event to be processed in main-thread.
00068  *
00069  * @details     The function will read the arrived packet from the transport layer
00070  *              which is passed for decoding by the rpc_cmd_decoder module.
00071  *
00072  * @param[in]   p_event_data   Event data. This will be NULL as rpc_evt_schedule
00073  *                             does not set any data.
00074  * @param[in]   event_size     Event data size. This will be 0 as rpc_evt_schedule
00075  *                             does not set any data.
00076  */
00077 void ble_rpc_cmd_handle(void * p_event_data, uint16_t event_size);
00078 
00079 #endif // BLE_RPC_CMD_DECODER_H__
00080 
00081 /** @} */