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

Static façade over one phyphox::Server. More...

#include <phyphoxBle.h>

Static Public Member Functions

static void start (const char *deviceName="phyphox-Arduino")
 Advertise as deviceName ("phyphox-Arduino" by default).
 
static void start (const char *deviceName, PhyphoxBleExperiment &experiment)
 Start and serve experiment in one call.
 
static void start (const char *deviceName, uint8_t *xml, size_t len)
 Serve a hand-written phyphox document instead of a generated one (1.x form).
 
static void start (uint8_t *xml, size_t len)
 
static void addExperiment (PhyphoxBleExperiment &experiment)
 Serve this description (copies it). May be called before or after start().
 
static void poll ()
 Gives the BLE stack CPU time and drives the transfer.
 
static void poll (int timeoutMs)
 1.x signature; the timeout is ignored
 
static void write (const float &v1)
 
static void write (const float &v1, const float &v2)
 
static void write (const float &v1, const float &v2, const float &v3)
 
static void write (const float &v1, const float &v2, const float &v3, const float &v4)
 
static void write (const float &v1, const float &v2, const float &v3, const float &v4, const float &v5)
 
static void write (uint8_t *bytes, unsigned int len)
 Raw arrays, up to the MTU payload; with setRepeating(n) the app unpacks n samples.
 
static void write (float *values, unsigned int count)
 
static void read (float &v1)
 
static void read (float &v1, float &v2)
 
static void read (float &v1, float &v2, float &v3)
 
static void read (float &v1, float &v2, float &v3, float &v4)
 
static void read (float &v1, float &v2, float &v3, float &v4, float &v5)
 
static void read (uint8_t *bytes, unsigned int len)
 user-XML mode: the raw cddf1003 value
 
static float readChannel (int channel)
 any input channel
 
static bool changed (int channel)
 true once per new value
 
static void onChange (int channel, phyphox::ChangeCallback)
 Attach a callback to an input channel after the experiment was added (the element's onChange() does the same before).
 
static void onPress (int channel, phyphox::PressCallback)
 
static const phyphox::ExperimentEvent & lastEvent ()
 
static void setMTU (uint16_t payload)
 Ask for an MTU payload up to 512 bytes (default 20).
 
static void printXML (Print *out)
 the document as the phone receives it
 
static void printErrors (Print *out)
 configuration errors, if any
 
static const phyphox::ServerStats & stats ()
 
static const char * version ()
 
static const char * transportName ()
 
static void begin (Print *debugOut)
 1.x: route debug output here (compiles now)
 
static phyphox::Server & server ()
 

Static Public Attributes

static void(* configHandler )()
 1.x hook: called after any value arrived from the phone (any channel, any sensor).
 
static void(* experimentEventHandler )()
 
static uint8_t eventType
 phyphox::EventType of the last event
 
static int64_t experimentTime
 ms since the experiment was started (−1 on SYNC)
 
static int64_t systemTime
 Unix time in ms as the phone sees it.
 
static uint16_t minConInterval
 Connection parameters in BLE units (1.25 ms, 1.25 ms, events, 10 ms).
 
static uint16_t maxConInterval
 
static uint16_t slaveLatency
 
static uint16_t timeout
 
static uint16_t currentConnections
 1.x field, kept up to date
 
static bool isSubscribed
 the phone subscribed to the data characteristic
 

Detailed Description

Static façade over one phyphox::Server.

Every method is a one-liner forwarding to it; the class exists so that PhyphoxBLE::start() and PhyphoxBLE::write(x) stay the whole story for the simplest sketches.

Member Function Documentation

◆ addExperiment()

static void PhyphoxBLE::addExperiment ( PhyphoxBleExperiment &  experiment)
static

Serve this description (copies it). May be called before or after start().

◆ begin()

static void PhyphoxBLE::begin ( Print *  debugOut)
static

1.x: route debug output here (compiles now)

◆ changed()

static bool PhyphoxBLE::changed ( int  channel)
static

true once per new value

◆ lastEvent()

static const phyphox::ExperimentEvent & PhyphoxBLE::lastEvent ( )
static

◆ onChange()

static void PhyphoxBLE::onChange ( int  channel,
phyphox::ChangeCallback   
)
static

Attach a callback to an input channel after the experiment was added (the element's onChange() does the same before).

◆ onPress()

static void PhyphoxBLE::onPress ( int  channel,
phyphox::PressCallback   
)
static

◆ poll() [1/2]

static void PhyphoxBLE::poll ( )
static

Gives the BLE stack CPU time and drives the transfer.

Required on every board; a no-op where the stack runs by itself (ESP32), so calling it never hurts.

◆ poll() [2/2]

static void PhyphoxBLE::poll ( int  timeoutMs)
static

1.x signature; the timeout is ignored

◆ printErrors()

static void PhyphoxBLE::printErrors ( Print *  out)
static

configuration errors, if any

◆ printXML()

static void PhyphoxBLE::printXML ( Print *  out)
static

the document as the phone receives it

◆ read() [1/6]

static void PhyphoxBLE::read ( float &  v1)
static

◆ read() [2/6]

static void PhyphoxBLE::read ( float &  v1,
float &  v2 
)
static

◆ read() [3/6]

static void PhyphoxBLE::read ( float &  v1,
float &  v2,
float &  v3 
)
static

◆ read() [4/6]

static void PhyphoxBLE::read ( float &  v1,
float &  v2,
float &  v3,
float &  v4 
)
static

◆ read() [5/6]

static void PhyphoxBLE::read ( float &  v1,
float &  v2,
float &  v3,
float &  v4,
float &  v5 
)
static

◆ read() [6/6]

static void PhyphoxBLE::read ( uint8_t *  bytes,
unsigned int  len 
)
static

user-XML mode: the raw cddf1003 value

◆ readChannel()

static float PhyphoxBLE::readChannel ( int  channel)
static

any input channel

◆ server()

static phyphox::Server & PhyphoxBLE::server ( )
static

◆ setMTU()

static void PhyphoxBLE::setMTU ( uint16_t  payload)
static

Ask for an MTU payload up to 512 bytes (default 20).

Emits the mtu attribute; the phone negotiates what it can (iOS always the maximum). Bandwidth path with the array write.

◆ start() [1/4]

static void PhyphoxBLE::start ( const char *  deviceName,
PhyphoxBleExperiment &  experiment 
)
static

Start and serve experiment in one call.

◆ start() [2/4]

static void PhyphoxBLE::start ( const char *  deviceName,
uint8_t *  xml,
size_t  len 
)
static

Serve a hand-written phyphox document instead of a generated one (1.x form).

◆ start() [3/4]

static void PhyphoxBLE::start ( const char *  deviceName = "phyphox-Arduino")
static

Advertise as deviceName ("phyphox-Arduino" by default).

Without addExperiment() the default experiment is served: a graph of channel 1 over time plus its value.

◆ start() [4/4]

static void PhyphoxBLE::start ( uint8_t *  xml,
size_t  len 
)
inlinestatic

◆ stats()

static const phyphox::ServerStats & PhyphoxBLE::stats ( )
static

◆ transportName()

static const char * PhyphoxBLE::transportName ( )
static

◆ version()

static const char * PhyphoxBLE::version ( )
inlinestatic

◆ write() [1/7]

static void PhyphoxBLE::write ( const float &  v1)
static

◆ write() [2/7]

static void PhyphoxBLE::write ( const float &  v1,
const float &  v2 
)
static

◆ write() [3/7]

static void PhyphoxBLE::write ( const float &  v1,
const float &  v2,
const float &  v3 
)
static

◆ write() [4/7]

static void PhyphoxBLE::write ( const float &  v1,
const float &  v2,
const float &  v3,
const float &  v4 
)
static

◆ write() [5/7]

static void PhyphoxBLE::write ( const float &  v1,
const float &  v2,
const float &  v3,
const float &  v4,
const float &  v5 
)
static

◆ write() [6/7]

static void PhyphoxBLE::write ( float *  values,
unsigned int  count 
)
static

◆ write() [7/7]

static void PhyphoxBLE::write ( uint8_t *  bytes,
unsigned int  len 
)
static

Raw arrays, up to the MTU payload; with setRepeating(n) the app unpacks n samples.

Member Data Documentation

◆ configHandler

void(* PhyphoxBLE::configHandler) ()
static

1.x hook: called after any value arrived from the phone (any channel, any sensor).

◆ currentConnections

uint16_t PhyphoxBLE::currentConnections
static

1.x field, kept up to date

◆ eventType

uint8_t PhyphoxBLE::eventType
static

phyphox::EventType of the last event

◆ experimentEventHandler

void(* PhyphoxBLE::experimentEventHandler) ()
static

◆ experimentTime

int64_t PhyphoxBLE::experimentTime
static

ms since the experiment was started (−1 on SYNC)

◆ isSubscribed

bool PhyphoxBLE::isSubscribed
static

the phone subscribed to the data characteristic

◆ maxConInterval

uint16_t PhyphoxBLE::maxConInterval
static

◆ minConInterval

uint16_t PhyphoxBLE::minConInterval
static

Connection parameters in BLE units (1.25 ms, 1.25 ms, events, 10 ms).

Defaults are Apple-compliant (15–30 ms); a request iOS cannot accept is ignored by iOS.

◆ slaveLatency

uint16_t PhyphoxBLE::slaveLatency
static

◆ systemTime

int64_t PhyphoxBLE::systemTime
static

Unix time in ms as the phone sees it.

◆ timeout

uint16_t PhyphoxBLE::timeout
static

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