Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Typedefs
att_api.h File Reference

Attribute protocol client and server API. More...

#include "wsf_timer.h"
#include "att_defs.h"
#include "att_uuid.h"
#include "dm_api.h"
#include "cfg_stack.h"

Go to the source code of this file.

Data Structures

struct  attCfg_t
 ATT run-time configurable parameters. More...
 
struct  eattCfg_t
 EATT run-time configurable parameters. More...
 
struct  attEvt_t
 ATT callback event. More...
 
struct  attsAttr_t
 Attribute structure. More...
 
struct  attsCsfRec_t
 Client supported features record structure. More...
 
struct  attsGroup_tag
 Attribute group. More...
 
struct  attsCccSet_t
 Client characteristc configuration settings. More...
 
struct  attsCccEvt_t
 ATTS client characteristic configuration callback structure. More...
 
struct  attcDiscChar_tag
 ATT client structure for characteristic and descriptor discovery. More...
 
struct  attcDiscCfg_t
 ATT client structure for characteristic and descriptor configuration. More...
 
struct  attcDiscCb_t
 ATT client discovery control block. More...
 

Macros

ATT Server Attribute Settings

Settings that may be set on each attribute.

#define ATTS_SET_UUID_128   0x01
 Set if the UUID is 128 bits in length. More...
 
#define ATTS_SET_WRITE_CBACK   0x02
 Set if the group callback is executed when this attribute is written by a client device. More...
 
#define ATTS_SET_READ_CBACK   0x04
 Set if the group callback is executed when this attribute is read by a client device. More...
 
#define ATTS_SET_VARIABLE_LEN   0x08
 Set if the attribute has a variable length. More...
 
#define ATTS_SET_ALLOW_OFFSET   0x10
 Set if writes are allowed with an offset. More...
 
#define ATTS_SET_CCC   0x20
 Set if the attribute is a client characteristic configuration descriptor. More...
 
#define ATTS_SET_ALLOW_SIGNED   0x40
 Set if signed writes are allowed. More...
 
#define ATTS_SET_REQ_SIGNED   0x80
 Set if signed writes are required if link is not encrypted. More...
 
ATT Server Attribute Permissions

Permissions used to describe a attribute's security setting.

These values can be set in any combination.

#define ATTS_PERMIT_READ   0x01
 Set if attribute can be read. More...
 
#define ATTS_PERMIT_READ_AUTH   0x02
 Set if attribute read requires authentication. More...
 
#define ATTS_PERMIT_READ_AUTHORIZ   0x04
 Set if attribute read requires authorization. More...
 
#define ATTS_PERMIT_READ_ENC   0x08
 Set if attribute read requires encryption. More...
 
#define ATTS_PERMIT_WRITE   0x10
 Set if attribute can be written. More...
 
#define ATTS_PERMIT_WRITE_AUTH   0x20
 Set if attribute write requires authentication. More...
 
#define ATTS_PERMIT_WRITE_AUTHORIZ   0x40
 Set if attribute write requires authorization. More...
 
#define ATTS_PERMIT_WRITE_ENC   0x80
 Set if attribute write requires encryption. More...
 
ATT Client Discovery and Configuration Settings

Settings used to configurate ATT Discovery procedure for ATT Clients.

#define ATTC_SET_UUID_128   0x01
 Set if the UUID is 128 bits in length. More...
 
#define ATTC_SET_REQUIRED   0x02
 Set if characteristic must be discovered. More...
 
#define ATTC_SET_DESCRIPTOR   0x04
 Set if this is a characteristic descriptor. More...
 

Typedefs

typedef void(* attCback_t) (attEvt_t *pEvt)
 ATT event callback type. More...
 
ATT Server Callbacks
typedef uint8_t(* attsReadCback_t) (dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, attsAttr_t *pAttr)
 Attribute group read callback. More...
 
typedef uint8_t(* attsWriteCback_t) (dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, uint16_t len, uint8_t *pValue, attsAttr_t *pAttr)
 Attribute group write callback. More...
 
typedef uint8_t(* attsAuthorCback_t) (dmConnId_t connId, uint8_t permit, uint16_t handle)
 ATTS authorization callback type. More...
 
typedef void(* attsCsfWriteCback_t) (dmConnId_t connId, uint8_t changeAwareState, uint8_t *pCsf)
 ATTS client supported features write callback type. More...
 
typedef void(* attsCccCback_t) (attsCccEvt_t *pEvt)
 ATTS client characteristic configuration callback. More...
 
Attribute Server Data Types
typedef struct attsGroup_tag attsGroup_t
 Attribute group. More...
 
ATT Client Data Types
typedef struct attcDiscChar_tag attcDiscChar_t
 ATT client structure for characteristic and descriptor discovery. More...
 

Enumerations

ATT Client Awareness of Database Change

Status of a client's awareness of a database change.

Functions

ATT Setup Functions
void AttRegister (attCback_t cback)
 Register a callback with ATT. This callback will be used for messages from both ATTC and ATTS. More...
 
void AttConnRegister (dmCback_t cback)
 Register a connection callback with ATT. The callback is typically used to manage the attribute server database. More...
 
ATT Parameter Functions

Functions specific to a connection between 2 devices.

Functions may be called by either Client or server.

uint16_t AttGetMtu (dmConnId_t connId)
 Get the attribute protocol MTU of a connection. More...
 
ATT Message Passing Functions
void * AttMsgAlloc (uint16_t len, uint8_t opcode)
 Allocate an ATT message buffer to be sent with the ATT attribute protocol zero-copy APIs. More...
 
void AttMsgFree (void *pMsg, uint8_t opcode)
 Free an ATT message buffer allocated with AttMsgAlloc(). More...
 
ATT Server Functions
void AttsInit (void)
 Initialize ATT server. More...
 
void AttsIndInit (void)
 Initialize ATT server for indications/notifications. More...
 
void AttsSignInit (void)
 Initialize ATT server for data signing. More...
 
void AttsAuthorRegister (attsAuthorCback_t cback)
 Register an authorization callback with the attribute server. More...
 
void AttsAddGroup (attsGroup_t *pGroup)
 Add an attribute group to the attribute server. More...
 
void AttsRemoveGroup (uint16_t startHandle)
 Remove an attribute group from the attribute server. More...
 
void AttsCalculateDbHash (void)
 Calculate database hash from the GATT database. More...
 
bool_t AttsHashDatabaseString (uint8_t *pKey, uint8_t *pMsg, uint16_t msgLen)
 Create hash from the database string. More...
 
uint8_t AttsSetAttr (uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Set an attribute value in the attribute server. More...
 
uint8_t AttsGetAttr (uint16_t handle, uint16_t *pLen, uint8_t **pValue)
 Get an attribute value in the attribute server. More...
 
void AttsHandleValueInd (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Send an attribute protocol Handle Value Indication. More...
 
void AttsHandleValueNtf (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Send an attribute protocol Handle Value Notification. More...
 
void AttsHandleValueIndZeroCpy (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Send an attribute protocol Handle Value Indication without copying the attribute value data. More...
 
void AttsHandleValueNtfZeroCpy (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Send an attribute protocol Handle Value Notification without copying the attribute value data. More...
 
void AttsCccRegister (uint8_t setLen, attsCccSet_t *pSet, attsCccCback_t cback)
 Register the utility service for managing client characteristic configuration descriptors. This function is typically called once on system initialization. More...
 
void AttsCccInitTable (dmConnId_t connId, uint16_t *pCccTbl)
 Initialize the client characteristic configuration descriptor value table for a connection. The table is initialized with the values from pCccTbl. If pCccTbl is NULL the table will be initialized to zero. More...
 
void AttsCccClearTable (dmConnId_t connId)
 Clear and deallocate the client characteristic configuration descriptor value table for a connection. This function must be called when a connection is closed. More...
 
uint16_t AttsCccGet (dmConnId_t connId, uint8_t idx)
 Get the value of a client characteristic configuration descriptor by its index. If not found, return zero. More...
 
void AttsCccSet (dmConnId_t connId, uint8_t idx, uint16_t value)
 Set the value of a client characteristic configuration descriptor by its index. More...
 
uint16_t AttsCccEnabled (dmConnId_t connId, uint8_t idx)
 Check if a client characteristic configuration descriptor is enabled and if the characteristic's security level has been met. More...
 
uint8_t AttsGetCccTableLen (void)
 Get number of CCC entries in table. More...
 
void AttsContinueWriteReq (dmConnId_t connId, uint16_t handle, uint8_t status)
 Send a response to a pending write request. For use with ATT_RSP_PENDING. More...
 
void AttsSetCsrk (dmConnId_t connId, uint8_t *pCsrk, bool_t authenticated)
 Set the peer's data signing key on this connection. This function is typically called from the ATT connection callback when the connection is established. The caller is responsible for maintaining the memory that contains the key. More...
 
void AttsSetSignCounter (dmConnId_t connId, uint32_t signCounter)
 Set the peer's sign counter on this connection. This function is typically called from the ATT connection callback when the connection is established. ATT maintains the value of the sign counter internally and sets the value when a signed packet is successfully received. More...
 
uint32_t AttsGetSignCounter (dmConnId_t connId)
 Get the current value peer's sign counter on this connection. This function is typically called from the ATT connection callback when the connection is closed so the application can store the sign counter for use on future connections. More...
 
void AttsCsfInit (void)
 Initialize ATTS client supported features module. More...
 
void AttsCsfConnOpen (dmConnId_t connId, uint8_t changeAwareState, uint8_t *pCsf)
 Initialize the client supported features for a connection. More...
 
uint8_t AttsCsfWriteFeatures (dmConnId_t connId, uint16_t offset, uint16_t valueLen, uint8_t *pValue)
 GATT write of client supported feature characteristic value. More...
 
void AttsCsfGetFeatures (dmConnId_t connId, uint8_t *pCsfOut, uint8_t pCsfOutLen)
 Get client supported feature record. More...
 
uint8_t AttsCsfGetClientChangeAwareState (dmConnId_t connId)
 Get client state of awareness to a change in the database. More...
 
void AttsCsfSetClientChangeAwareState (dmConnId_t connId, uint8_t state)
 Update a client's state of awareness to a change in the database. More...
 
void AttsCsfRegister (attsCsfWriteCback_t writeCback)
 Register callback. More...
 
ATT Server Dynamic Service Subsystem Functions
void AttsDynInit (void)
 Initialize the Dynamic ATT Service subsystem. More...
 
void * AttsDynCreateGroup (uint16_t startHandle, uint16_t endHandle)
 Dynamically create an ATT Service at runtime. More...
 
void AttsDynDeleteGroup (void *pSvcHandle)
 Dynamically delete an ATT Service at runtime. More...
 
void AttsDynRegister (void *pSvcHandle, attsReadCback_t readCback, attsWriteCback_t writeCback)
 Register callback functions for a dynamic ATT Service at runtime. More...
 
void AttsDynAddAttr (void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue, uint16_t len, const uint16_t maxLen, uint8_t settings, uint8_t permissions)
 Dynamically add an attribute to a dynamic ATT Services at runtime. More...
 
void AttsDynAddAttrConst (void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue, const uint16_t len, uint8_t settings, uint8_t permissions)
 Dynamically add an attribute with a constant value to a dynamic ATT Services at runtime. More...
 
ATT Server Testing
void AttsErrorTest (uint8_t status)
 For testing purposes only. More...
 
ATT Client Functions
void AttcInit (void)
 Initialize ATT client. More...
 
void AttcSignInit (void)
 Initialize ATT client for data signing. More...
 
void AttcFindInfoReq (dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, bool_t continuing)
 Initiate an attribute protocol Find Information Request. More...
 
void AttcFindByTypeValueReq (dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, uint16_t uuid16, uint16_t valueLen, uint8_t *pValue, bool_t continuing)
 Initiate an attribute protocol Find By Type Value Request. More...
 
void AttcReadByTypeReq (dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
 Initiate an attribute protocol Read By Type Request. More...
 
void AttcReadReq (dmConnId_t connId, uint16_t handle)
 Initiate an attribute protocol Read Request. More...
 
void AttcReadLongReq (dmConnId_t connId, uint16_t handle, uint16_t offset, bool_t continuing)
 Initiate an attribute protocol Read Long Request. More...
 
void AttcReadMultipleReq (dmConnId_t connId, uint8_t numHandles, uint16_t *pHandles)
 Initiate an attribute protocol Read Multiple Request. More...
 
void AttcReadByGroupTypeReq (dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
 Initiate an attribute protocol Read By Group Type Request. More...
 
void AttcWriteReq (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Initiate an attribute protocol Write Request. More...
 
void AttcWriteCmd (dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
 Initiate an attribute protocol Write Command. More...
 
void AttcSignedWriteCmd (dmConnId_t connId, uint16_t handle, uint32_t signCounter, uint16_t valueLen, uint8_t *pValue)
 Initiate an attribute protocol signed Write Command. More...
 
void AttcPrepareWriteReq (dmConnId_t connId, uint16_t handle, uint16_t offset, uint16_t valueLen, uint8_t *pValue, bool_t valueByRef, bool_t continuing)
 Initiate an attribute protocol Prepare Write Request. More...
 
void AttcExecuteWriteReq (dmConnId_t connId, bool_t writeAll)
 Initiate an attribute protocol Execute Write Request. More...
 
void AttcCancelReq (dmConnId_t connId)
 Cancel an attribute protocol request in progress. More...
 
void AttcDiscService (dmConnId_t connId, attcDiscCb_t *pCb, uint8_t uuidLen, uint8_t *pUuid)
 This utility function discovers the given service on a peer device. Function AttcFindByTypeValueReq() is called to initiate the discovery procedure. More...
 
uint8_t AttcDiscServiceCmpl (attcDiscCb_t *pCb, attEvt_t *pMsg)
 This utility function processes a service discovery result. It should be called when an ATTC_FIND_BY_TYPE_VALUE_RSP callback event is received after service discovery is initiated by calling AttcDiscService(). More...
 
void AttcDiscCharStart (dmConnId_t connId, attcDiscCb_t *pCb)
 This utility function starts characteristic and characteristic descriptor discovery for a service on a peer device. The service must have been previously discovered by calling AttcDiscService() and AttcDiscServiceCmpl(). More...
 
uint8_t AttcDiscCharCmpl (attcDiscCb_t *pCb, attEvt_t *pMsg)
 This utility function processes a characteristic discovery result. It should be called when an ATTC_READ_BY_TYPE_RSP or ATTC_FIND_INFO_RSP callback event is received after characteristic discovery is initiated by calling AttcDiscCharStart(). More...
 
void AttcDiscIncSvcStart (dmConnId_t connId, attcDiscCb_t *pCb)
 This utility function starts service include discovery for a service on a peer device. The service must have been previously discovered by calling AttcDiscService() and AttcDiscServiceCmpl(). More...
 
uint8_t AttcDiscIncSvcCmpl (attcDiscCb_t *pCb, attEvt_t *pMsg)
 This utility function processes a service include discovery result. It should be called when an ATTC_READ_BY_TYPE_RSP allback event is received after service include discovery is initiated by calling AttcDiscIncSvcStart(). More...
 
uint8_t AttcDiscConfigStart (dmConnId_t connId, attcDiscCb_t *pCb)
 This utility function starts characteristic configuration for characteristics on a peer device. The characteristics must have been previously discovered by calling AttcDiscCharStart() and AttcDiscCharCmpl(). More...
 
uint8_t AttcDiscConfigCmpl (dmConnId_t connId, attcDiscCb_t *pCb)
 This utility function initiates the next characteristic configuration procedure. It should be called when an ATTC_READ_RSP or ATTC_WRITE_RSP callback event is received after characteristic configuration is initiated by calling AttcDiscConfigStart(). More...
 
uint8_t AttcDiscConfigResume (dmConnId_t connId, attcDiscCb_t *pCb)
 This utility function resumes the characteristic configuration procedure. It can be called when an ATTC_READ_RSP or ATTC_WRITE_RSP callback event is received with failure status to attempt the read or write procedure again. More...
 
void AttcMtuReq (dmConnId_t connId, uint16_t mtu)
 Initiate an attribute protocol Exchange MTU Request. More...
 
void AttcSetAutoConfirm (bool_t enable)
 Set automatic Indication Confirmations sent from this ATT Client. More...
 
void AttcIndConfirm (dmConnId_t connId)
 Send an attribute protocol indication confirmation. More...
 

Variables

ATT Configuration Structure

Pointer to structure containing initialization details of the ATT Subsystem.

To be configured by Application.

attCfg_tpAttCfg
 Configuration pointer. More...
 
eattCfg_tpEattCfg
 Enhanced configuration pointer. More...
 

ATT Callback Events

Events related to ATT transactions.

#define ATT_CBACK_START   0x02
 ATT callback event starting value. More...
 
#define ATT_CBACK_END   ATT_EATT_RECONFIG_CMPL_IND
 ATT callback events. More...
 

Detailed Description

Attribute protocol client and server API.

Copyright (c) 2009-2019 Arm Ltd. All Rights Reserved.

Copyright (c) 2019-2020 Packetcraft, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file att_api.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.