Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
ersa::protocols::AncsAttributes Class Reference

#include <apple_notifications.h>

Public Types

enum class  Result { More , Complete , Invalid }
 

Public Member Functions

void begin (uint32_t uid, bool includeNegativeAction=false)
 
Result feed (const uint8_t *data, size_t length)
 
bool negativeActionIsDismissal () const
 

Static Public Member Functions

static void request (uint32_t uid, bool includeNegativeAction, uint8_t *out)
 
static void request (uint32_t uid, uint8_t(&out)[11])
 

Public Attributes

char title [32] {}
 
char message [64] {}
 
char negativeActionLabel [32] {}
 

Private Attributes

uint32_t uid_ {0}
 
bool includeNegativeAction_ {false}
 
uint8_t bytes_ [140] {}
 
size_t size_ {0}
 

Detailed Description

Transport-independent decoder for one ANCS notification-attribute response.

The firmware issues at most one attribute request at a time, so this parser accumulates its fragments in one bounded buffer and verifies the UID before publishing text. It knows the ANCS wire format but not GATT callbacks; that split makes malformed/truncated packet behavior testable without a radio.

Member Enumeration Documentation

◆ Result

Response parser state returned by feed().

Enumerator
More 
Complete 
Invalid 

Member Function Documentation

◆ begin()

void ersa::protocols::AncsAttributes::begin ( uint32_t  uid,
bool  includeNegativeAction = false 
)
inline

Start collecting the response for uid and clear prior text.

Parameters
uidNotification identifier expected in the next response.
includeNegativeActionAlso parse the optional action label.

◆ feed()

Result ersa::protocols::AncsAttributes::feed ( const uint8_t *  data,
size_t  length 
)
inline

Append a response fragment and parse any complete requested attributes.

Returns
More while bytes are incomplete, Complete for an exact valid response, or Invalid for overflow, wrong UID/order, or extra data.

◆ negativeActionIsDismissal()

bool ersa::protocols::AncsAttributes::negativeActionIsDismissal ( ) const
inline

Return whether the optional negative action label means dismiss/clear. Whitespace and ASCII case are ignored to handle common provider variants.

◆ request() [1/2]

static void ersa::protocols::AncsAttributes::request ( uint32_t  uid,
bool  includeNegativeAction,
uint8_t *  out 
)
inlinestatic

Encode the ANCS Get Notification Attributes command into caller storage. The output needs 11 bytes for title/message and 12 when action label is requested; caller supplies the correct capacity for the selected form.

◆ request() [2/2]

static void ersa::protocols::AncsAttributes::request ( uint32_t  uid,
uint8_t(&)  out[11] 
)
inlinestatic

Convenience overload for the standard fixed 11-byte request.

Member Data Documentation

◆ bytes_

uint8_t ersa::protocols::AncsAttributes::bytes_[140] {}
private

◆ includeNegativeAction_

bool ersa::protocols::AncsAttributes::includeNegativeAction_ {false}
private

◆ message

char ersa::protocols::AncsAttributes::message[64] {}

◆ negativeActionLabel

char ersa::protocols::AncsAttributes::negativeActionLabel[32] {}

◆ size_

size_t ersa::protocols::AncsAttributes::size_ {0}
private

◆ title

char ersa::protocols::AncsAttributes::title[32] {}

◆ uid_

uint32_t ersa::protocols::AncsAttributes::uid_ {0}
private

The documentation for this class was generated from the following file: