Microchip® Advanced Software Framework

tx_power.h File Reference

TX Service declarations.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include "ble_manager.h"

Data Structures

struct  gatt_txps_char_handler
 
struct  gatt_txps_char_handler
 

Macros

#define DEFAULT_TX_PWR_VALUE   (0)
 DEFAULT_TX_PWR_VALUE the tx power value. More...
 
#define MAX_TX_POWER_CHAR_SIZE   (1)
 
#define TXPS_CHARACTERISTIC_COUNT   (1)
 count of characteristics in tx power service More...
 
#define TXPS_CLIENT   0
 
#define TXPS_INCLUDED_SERVICE_COUNT   (0)
 count of included service in tx power service More...
 
#define TXPS_INVALID_CHAR_HANDLE   (0)
 
#define TXPS_INVALID_POWER_VALUE   (0xFF)
 
#define TXPS_POWER_READ_LENGTH   (1)
 
#define TXPS_POWER_READ_OFFSET   (0)
 
#define TXPS_SERVER   0
 

Typedefs

typedef struct
gatt_txps_char_handler 
gatt_txps_char_handler_t
 

Functions

void init_tx_power_service (gatt_service_handler_t *tx_power_serv)
 Initialize the tx power service with default values. More...
 
at_ble_status_t txps_power_read (at_ble_handle_t conn_handle, at_ble_handle_t char_handle)
 Send the Read Request to Tx Power service. More...
 
int8_t txps_power_read_response (at_ble_characteristic_read_response_t *char_read_resp, gatt_txps_char_handler_t *txps_handler)
 Read a Tx Power. More...
 
at_ble_status_t txps_primary_service_define (gatt_service_handler_t *txps_primary_service)
 Defining the tx power service to the attribute data base. More...
 

#define DEFAULT_TX_PWR_VALUE   (0)

DEFAULT_TX_PWR_VALUE the tx power value.

#define MAX_TX_POWER_CHAR_SIZE   (1)
#define TXPS_CHARACTERISTIC_COUNT   (1)

count of characteristics in tx power service

Referenced by txps_primary_service_define().

#define TXPS_CLIENT   0
#define TXPS_INCLUDED_SERVICE_COUNT   (0)

count of included service in tx power service

Referenced by txps_primary_service_define().

#define TXPS_INVALID_CHAR_HANDLE   (0)

Referenced by txps_power_read().

#define TXPS_INVALID_POWER_VALUE   (0xFF)
#define TXPS_POWER_READ_LENGTH   (1)
#define TXPS_POWER_READ_OFFSET   (0)
#define TXPS_SERVER   0

void init_tx_power_service ( gatt_service_handler_t tx_power_serv)

Initialize the tx power service with default values.

Parameters
[in]gatt_service_handler_tthe service info which has handle range,uuid and characteristic array fields
Precondition
Must be called before txps_primary_service_define
Returns
void

Initialize the tx power service with default values.

References AT_BLE_ATTR_NO_PERMISSIONS, AT_BLE_ATTR_READABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_READABLE_REQ_AUTHN_NO_AUTHR, AT_BLE_CHAR_READ, AT_BLE_UUID_16, NULL, tx_power_initial_value, TX_POWER_LEVEL_CHAR_UUID, and TX_POWER_SERVICE_UUID.

Referenced by pxp_service_init().

at_ble_status_t txps_power_read ( at_ble_handle_t  conn_handle,
at_ble_handle_t  char_handle 
)

Send the Read Request to Tx Power service.

Read value will be reported via AT_BLE_CHARACTERISTIC_READ_RESPONSE event

Parameters
[in]conn_handlehandle of the connection
[in]char_handlehandle of the characteristic
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_INVALID_PARAM Invalid arguments.
AT_BLE_FAILURE Generic error.

References AT_BLE_ATT_INVALID_HANDLE, at_ble_characteristic_read(), TXPS_INVALID_CHAR_HANDLE, TXPS_POWER_READ_LENGTH, and TXPS_POWER_READ_OFFSET.

Referenced by pxp_monitor_discovery_complete_handler().

at_ble_status_t txps_primary_service_define ( gatt_service_handler_t txps_primary_service)

Defining the tx power service to the attribute data base.

Parameters
[in]gatt_service_handler_tthe service info which has handle range,uuid and characteristic array fields
Precondition
Must be called after init_tx_power_service
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

Defining the tx power service to the attribute data base.

References at_ble_primary_service_define(), NULL, TXPS_CHARACTERISTIC_COUNT, and TXPS_INCLUDED_SERVICE_COUNT.

Referenced by pxp_service_define().