phyphox BLE
Plot your Arduino's data in the phyphox app and control the board from the phone
Loading...
Searching...
No Matches
phyphox::nina Namespace Reference

Classes

struct  Event
 
class  EventQueue
 Fixed ring of event lines, filled while a command waits for its response and drained from poll(). More...
 
class  LineReader
 Assembles lines from the byte stream. More...
 

Enumerations

enum  EventKind : uint8_t {
  EV_NONE , EV_CONNECTED , EV_DISCONNECTED , EV_WRITE ,
  EV_READ , EV_OTHER
}
 

Functions

int hexVal (char c)
 
uint16_t decodeHex (const char *s, uint8_t *out, uint16_t cap)
 Decode hex digits up to the first non-hex character; returns the byte count.
 
void encodeHex (const uint8_t *data, uint16_t len, char *out)
 
bool isEvent (const char *line)
 Unsolicited result codes all start with "+UU"; everything else belongs to the command in flight.
 
bool startsWith (const char *line, const char *prefix)
 
int firstNumber (const char *line)
 The integer after ':' (a handle), or -1 if the line has none.
 
bool parseCharacteristicResponse (const char *line, int &valueHandle, int &cccdHandle)
 "+UBTGCHA:<value_handle>,<cccd_handle>"; cccd is 0 when the characteristic has none.
 
Event parseEvent (const char *line)
 Classify and parse one unsolicited line.
 

Variables

static const uint16_t kLineMax = 128
 Longest line kept: a 20-byte write is ~62 characters, a six-component sensor write ~70.
 

Enumeration Type Documentation

◆ EventKind

enum phyphox::nina::EventKind : uint8_t
Enumerator
EV_NONE 
EV_CONNECTED 
EV_DISCONNECTED 
EV_WRITE 
EV_READ 
EV_OTHER 

Function Documentation

◆ decodeHex()

uint16_t phyphox::nina::decodeHex ( const char *  s,
uint8_t *  out,
uint16_t  cap 
)
inline

Decode hex digits up to the first non-hex character; returns the byte count.

◆ encodeHex()

void phyphox::nina::encodeHex ( const uint8_t *  data,
uint16_t  len,
char *  out 
)
inline

◆ firstNumber()

int phyphox::nina::firstNumber ( const char *  line)
inline

The integer after ':' (a handle), or -1 if the line has none.

◆ hexVal()

int phyphox::nina::hexVal ( char  c)
inline

◆ isEvent()

bool phyphox::nina::isEvent ( const char *  line)
inline

Unsolicited result codes all start with "+UU"; everything else belongs to the command in flight.

◆ parseCharacteristicResponse()

bool phyphox::nina::parseCharacteristicResponse ( const char *  line,
int &  valueHandle,
int &  cccdHandle 
)
inline

"+UBTGCHA:<value_handle>,<cccd_handle>"; cccd is 0 when the characteristic has none.

◆ parseEvent()

Event phyphox::nina::parseEvent ( const char *  line)
inline

Classify and parse one unsolicited line.

◆ startsWith()

bool phyphox::nina::startsWith ( const char *  line,
const char *  prefix 
)
inline

Variable Documentation

◆ kLineMax

const uint16_t phyphox::nina::kLineMax = 128
static

Longest line kept: a 20-byte write is ~62 characters, a six-component sensor write ~70.

(Not LINE_MAX: that is a POSIX macro in the ESP32 toolchain's <limits.h>.)