FireBLE/PROXR

来自Firefly wiki
跳转至: 导航搜索

Introduction

Proxr(Proximity Reportor) profile provides three server:one is Link Loss Server,it allows the user to set an alert level in the Reporter, which will be used by the reporter to alert in the corresponding way if the link is lost.Second is The immediate alert server,it allows the user to set an immediate alert level based on path loss computation using the read Tx Power Level and RSSI monitored on received packets. According to the alert level set in IAS, the Reporter will start alerting immediately.The Tx Power Server allows the user to read the Tx Power Level for the physical layer. The value is used by the Monitor to continuously evaluate path loss during the connection, and decide to trigger/stop an alert based on path loss going over/under a set threshold in the Monitor application.

Role Definition

In Proximity Reportor Profile,it plays a Server role in ATT layer,it provide three server to Client.In GAP layer it also play a peripheral.

Profile

A profile defines an optimal setting for a particular application.In Quintic Proximity profile:

  • LLS(Link Loss Server)
  • IAS(Immediate Alert Server)
  • TPS(Tx Power Server)

LLS and TPS use for indicate the distance between host and peripheral,IAS is a server to operation the peripheral directly.

Link Loss Server

In proxr,LLS has provide a database:

 /// Full LLS Database Description - Used to add attributes into the database
 const struct atts_desc proxr_lls_att_db[LLS_IDX_NB] =
 {
     // Link Loss Service Declaration
     [LLS_IDX_SVC]                      =   {ATT_DECL_PRIMARY_SERVICE, PERM(RD, ENABLE), sizeof(proxr_lls_svc),
                                          sizeof(proxr_lls_svc), (uint8_t *)&proxr_lls_svc},
 
     // Alert Level Characteristic Declaration
     [LLS_IDX_ALERT_LVL_CHAR]        =   {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(proxr_lls_alert_lvl_char),
                                          sizeof(proxr_lls_alert_lvl_char), (uint8_t *)&proxr_lls_alert_lvl_char},
     // Alert Level Characteristic Value
     [LLS_IDX_ALERT_LVL_VAL]         =   {ATT_CHAR_ALERT_LEVEL, PERM(RD, ENABLE) | PERM(WR, ENABLE), sizeof(uint8_t),
                                          0, NULL},
 };

The first of the database is the declaration of the service,and property is read-only.The second,it's a declaration of characteristic,property is read-only.The third,it's a declaration of characteristic value,the value's property is read-write.the declaration of Server and characteristic all with a property read-only,this value is a UUID to location them.and the characteristic value is rean-write,it provide a value to indicate the alert level.In case,when host judge the value of RSSI is not on the defauld safe risk,it will set this value to indicate peripheral the alert level and start alert.

 /// Link Loss Service
 const atts_svc_desc_t proxr_lls_svc     = ATT_SVC_LINK_LOSS;
 
 /// Link Loss Service - Alert Level Characteristic
 const struct atts_char_desc proxr_lls_alert_lvl_char = ATTS_CHAR(ATT_CHAR_PROP_RD | ATT_CHAR_PROP_WR,
                                                                     0,
                                                                     ATT_CHAR_ALERT_LEVEL);
   /*----------------- SERVICES ---------------------*/
   /// Generic Access Profile
   ATT_SVC_GENERIC_ACCESS              = 0x1800,
   /// Attribute Profile
   ATT_SVC_GENERIC_ATTRIBUTE,
   ///Immediate alert service
   ATT_SVC_IMMEDIATE_ALERT,
   ///Link Loss Service
   ATT_SVC_LINK_LOSS,
   /// Alert Level characteristic
   ATT_CHAR_ALERT_LEVEL                        = 0x2A06,

we could see the define of the uuid,ATT_SVC_LINK_LOSS的1804,ATT_CHAR_ALERT_LEVET

is define to 2A06,the same of Light Blue show to us.

Immediate Alert Server

It's very like LLS,but different of their UUID,so they are in different server and have Noninterference .

TX Power Server

 /// Full TXPS Database Description - Used to add attributes into the database
 const struct atts_desc proxr_txps_att_db[TXPS_IDX_NB] =
 {
     // TX Power Service Declaration
     [TXPS_IDX_SVC]                  =   {ATT_DECL_PRIMARY_SERVICE, PERM(RD, ENABLE), sizeof(proxr_txps_svc),
                                          sizeof(proxr_txps_svc), (uint8_t *)&proxr_txps_svc},
 
     // TX Power Level Characteristic Declaration
     [TXPS_IDX_TX_POWER_LVL_CHAR]       =   {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(proxr_txps_tx_power_lvl_char),
                                          sizeof(proxr_txps_tx_power_lvl_char), (uint8_t *)&proxr_txps_tx_power_lvl_char},
     // TX Power Level Characteristic Value
     [TXPS_IDX_TX_POWER_LVL_VAL]     =   {ATT_CHAR_TX_POWER_LEVEL, PERM(RD, ENABLE), sizeof(int8_t),
                                          0, NULL},
 };

TX Power Server provide a value to read the Tx Power.