![]() |
NHS31xx SW API
|
The Therapy Adherence Demo Sensing component is responsible for providing a normalized and simplified interface to handle pill presence sensing. It is also responsible for managing the sensing circuit and configuration of the sensor(s). Its functionality is simplified down to on single API function to trigger the sensing. The application will be triggered via a callback function at the moment that an event occurs.
Modules | |
Specific part for the Sensing Component | |
Data Structures | |
struct | SENSE_PILL_REMOVAL_INFO_T |
Macros | |
#define | SENSE_MAX_GROUP_COUNT 6 |
#define | SENSE_INSTANCE_SIZE 40 |
Typedefs | |
typedef void(* | Sense_RemovalCb_t) (const SENSE_PILL_REMOVAL_INFO_T *pInfo) |
Functions | |
int | Sense_StartTherapy (void *pInstance) |
int | Sense_SensePillRemoval (void *pInstance, Sense_RemovalCb_t cb) |
struct SENSE_PILL_REMOVAL_INFO_T |
Structure used by the sensing component to inform the upper layer (via callback) about a pill removal
#define SENSE_MAX_GROUP_COUNT 6 |
The maximum amount of pill groups.
#define SENSE_INSTANCE_SIZE 40 |
Size of Instance buffer required by the SENSE module for internal housekeeping.
typedef void(* Sense_RemovalCb_t) (const SENSE_PILL_REMOVAL_INFO_T *pInfo) |
Whenever an event (pill removal) is sensed, the application is notified via a callback of this prototype. It then has a chance to act accordingly. Think about updating the NDEF TEXT message and/or storing this event in non-volatile memory. This Callback can be expected during execution of (and only then) Sense_SensePillRemoval. The application is in charge of:
pInfo | : pointer to the info about the pill removal which is the subject of the callback. |
int Sense_StartTherapy | ( | void * | pInstance | ) |
This function initialize the module for a new therapy.
pInstance | : pointer to ram location where to store internal data, this buffer needs to be of size SENSE_INSTANCE_SIZE. |
int Sense_SensePillRemoval | ( | void * | pInstance, |
Sense_RemovalCb_t | cb | ||
) |
This function will sense all pill groups, if a difference is observed between the newly sensed pill removals and the previous (stored in pInstance), SENSE_CB
is called to inform the higher levels about new event(s).
pInstance | : Base address of instance Buffer. The instance buffer preserves the necessary housekeeping information during an instantiation of the SENSE module. The caller must ensure that the argument pInstance points to a buffer of size SENSE_INSTANCE_SIZE bytes. |
cb | : A function pointer to a callback, this will be called for every new pill removal recorded. |
SENSE_CB
will be called if new pill removal is observed.