NHS31xx SW API

Detailed Description

This file describes the application specific commands and responses used in the Therapy Adherence demo application.

Data Structures

struct  MSG_RHYTHM_T
 
struct  MSG_CMD_START_T
 
struct  MSG_RESPONSE_GETSTART_T
 
struct  MSG_RESPONSE_GETPILLREMOVALS_T
 

Typedefs

typedef MSG_RHYTHM_T MSG_CMD_SETRHYTHM_T
 
typedef MSG_RHYTHM_T MSG_RESPONSE_GETRHYTHM_T
 

Enumerations

enum  MSGHANDLER_MSG_ID_T {
  MSG_INCOMING_PACKAGE = 0x48,
  MSG_LAST_INCOMING_PACKAGE = 0x49,
  MSG_ID_SETPRISTINE = 0x5A,
  MSG_ID_SETRHYTHM = 0x55,
  MSG_ID_GETRHYTHM = 0x56,
  MSG_ID_START = 0x57,
  MSG_ID_GETSTART = 0x58,
  MSG_ID_GETPILLREMOVALS = 0x5D
}
 

Data Structure Documentation

◆ MSG_RHYTHM_T

struct MSG_RHYTHM_T
Data Fields
uint32_t period

The total time in seconds of one period, in which all intakes described below must take place.

Note
For example, to describe a rhythm in which the pill intakes are the same for each day, this value will equal 86400.
uint32_t intakeOffset[16]

An array of times at which a pill intake ideally takes place. The time is expressed in seconds and is relative to the start of a period. A maximum of 16 pill intake moments can be defined: in case less moments are required, a value equal to or bigger than period must be assigned to the superfluous elements in the array.

Note
Continuing the example with period equal to 1 day,
Precondition
Must be less than period
Note
Multiple pill intake moments can be defined at the same time.
The pill intake moments must be sorted ascending, i.e. the (n+1)th entry must be equal to or bigger than the nth entry.
Continuing the example with period equal to 1 day, an array with values 28800, 64800, 64800 followed by 0xffffffff for all remainder array would define two pill intake moments: the first moment at 8:00.00 AM for the first pill, the second moment at 6:00.00 PM for the second and the third pill.
uint32_t leniency

Half the width of the band around each ideal pill intake moment which is still considered adherent to the therapy. Expressed in number of seconds.

Precondition
Must be bigger than 0
Must be less than period
Note
The width of the band is double the value given here.
The ideal pill intake moment is centered in this band, meaning this value indicates the allowed deviation in absolute value.
The band for a pill intake moment may be as wide as to include the ideal time of an earlier or later pill intake moment, or may spill over to an earlier or later period.
It is possible that due to the width of the bands the (n+1)th pill - which was ideally taken after the nth pill - is taken before the nth pill and still the therapy is considered adherent.
Continuing the example with period equal to 1 day and pill intake moments at 8 AM and 6 PM, a value of 7200 indicates that the first pill must be taken after 6:00.00 AM and before 10:00.00 AM, and the second and third pills must be taken after 4:00.00 PM and before 8:00.00 PM, in any order.

◆ MSG_CMD_START_T

struct MSG_CMD_START_T
See also
MSG_ID_START
Data Fields
uint32_t current

The current time in epoch seconds.

uint32_t updateInterval

The number of seconds in between 2 updates (pill sensing).

◆ MSG_RESPONSE_GETSTART_T

struct MSG_RESPONSE_GETSTART_T
Data Fields
uint32_t current

The current time in epoch seconds.

uint32_t start

The time when the therapy was started in epoch seconds.

◆ MSG_RESPONSE_GETPILLREMOVALS_T

struct MSG_RESPONSE_GETPILLREMOVALS_T
See also
MSG_ID_GETEVENTS
Data Fields
THERAPY_PILLREMOVAL_INFO_T removals[36]

An array of pill removals. Each slot reports one event: when two events occurred at the same time, two slots are taken with the same value for time. When less events occurred than there are slots available, the remainder of the slots are filled with zeros.

Note
The events are ordered in time, i.e. with m less than n, the time given in slot m will be less than or equal to the time given in slot n.

Typedef Documentation

◆ MSG_CMD_SETRHYTHM_T

◆ MSG_RESPONSE_GETRHYTHM_T

Enumeration Type Documentation

◆ MSGHANDLER_MSG_ID_T

List of all message ids, referring to the respective command and response structures.

Enumerator
MSG_INCOMING_PACKAGE 

0x48
Incremental data package

MSG_LAST_INCOMING_PACKAGE 

0x49
Last incremental data package including the binary CRC

MSG_ID_SETPRISTINE 

0x5A
Removes all information that was received via any command. Removes all stored events.

Parameters
MSG_CMD_TAGONLY_T
Returns
MSG_RESPONSE_RESULTONLY_T
Note
synchronous command
MSG_ID_SETRHYTHM 

0x55
Defines the rhythm the patient must adhere to when following the therapy. The application will determine based on this information whether the patient still adheres to the therapy.

Note
In case the application tracks different pills - each pill is specific and the order of intake of each pill is important - it is assumed the first pill must ideally be taken at the first pill intake moment, the nth pill must ideally be taken at the nth pill intake moment, and so on.
Parameters
MSG_CMD_SETRHYTHM_T
Returns
MSG_RESPONSE_RESULTONLY_T
Note
synchronous command
MSG_ID_GETRHYTHM 

0x56
Retrieves rhythm information that was set by the last command with id MSG_ID_SETRHYTHM.

Parameters
MSG_CMD_TAGONLY_T
Returns
MSG_RESPONSE_GETRHYTHM_T
Note
synchronous command
MSG_ID_START 

0x57
Sets the time when the therapy starts. When this command is received, events will be tracked and followed up by the IC. All events before the given start time are considered out-of-band; all events after the given start time that do not follow the prescribed rhythm are also considered out-of-band.

Note
Mandatory configuration messages that must be exchanged before this command is accepted:
The therapy ends automatically when all drugs have been taken, or when a command with message id MSG_ID_SETPRISTINE is received.
Precondition
The therapy has not yet been started.
Parameters
MSG_CMD_START_T
Returns
MSG_RESPONSE_RESULTONLY_T
Note
synchronous command
MSG_ID_GETSTART 

0x58
Retrieves the start time that was set by the last command with id MSG_ID_START.

Parameters
MSG_CMD_TAGONLY_T
Returns
MSG_RESPONSE_GETSTART_T
Note
synchronous command
MSG_ID_GETPILLREMOVALS 

0x5D
Retrieves all pill removals that have been recorded since the start of the therapy.

Parameters
MSG_CMD_TAGONLY_T
Returns
MSG_RESPONSE_GETPILLREMOVALS_T
Note
synchronous command
Retrieving the pill removals does not clear them from the IC. Issuing the same command again will yield the same response - possibly expanded with new removals.