Cordio Stack and Cordio Profiles  r2p3-02rel0
glps_main.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Glucose profile sensor internal interfaces.
6  *
7  * Copyright (c) 2012-2018 Arm Ltd. All Rights Reserved.
8  * Arm Ltd. confidential and proprietary.
9  *
10  * IMPORTANT. Your use of this file is governed by a Software License Agreement
11  * ("Agreement") that must be accepted in order to download or otherwise receive a
12  * copy of this file. You may not use or copy this file for any purpose other than
13  * as described in the Agreement. If you do not agree to all of the terms of the
14  * Agreement do not use this file and delete all copies in your possession or control;
15  * if you do not have a copy of the Agreement, you must contact Arm Ltd. prior
16  * to any use, copying or further distribution of this software.
17  */
18 /*************************************************************************************************/
19 #ifndef GLPS_MAIN_H
20 #define GLPS_MAIN_H
21 
22 #include "app_hw.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*! \addtogroup GLUCOSE_PROFILE
29  * \{ */
30 
31 /**************************************************************************************************
32  Macros
33 **************************************************************************************************/
34 
35 /*! \brief Minimum RACP write length */
36 #define GLPS_RACP_MIN_WRITE_LEN 2
37 
38 /*! \brief RACP response length */
39 #define GLPS_RACP_RSP_LEN 4
40 
41 /*! \brief Glucose RACP number of stored records response length */
42 #define GLPS_RACP_NUM_REC_RSP_LEN 4
43 
44 /*! \brief RACP operand maximum length */
45 #define GLPS_OPERAND_MAX ((CH_RACP_GLS_FILTER_TIME_LEN * 2) + 1)
46 
47 /**************************************************************************************************
48  Data Types
49 **************************************************************************************************/
50 
51 /*! \brief Glucose measurement structure */
52 typedef struct
53 {
54  uint8_t flags; /*!< \brief Flags */
55  uint16_t seqNum; /*!< \brief Sequence number */
56  appDateTime_t baseTime; /*!< \brief Base time */
57  int16_t timeOffset; /*!< \brief Time offset */
58  uint16_t concentration; /*!< \brief Glucose concentration (SFLOAT) */
59  uint8_t typeSampleLoc; /*!< \brief Sample type and sample location */
60  uint16_t sensorStatus; /*!< \brief Sensor status annunciation */
61 } glpsGlm_t;
62 
63 /*! \brief Glucose measurement context structure */
64 typedef struct
65 {
66  uint8_t flags; /*!< \brief Flags */
67  uint16_t seqNum; /*!< \brief Sequence number */
68  uint8_t extFlags; /*!< \brief Extended Flags */
69  uint8_t carbId; /*!< \brief Carbohydrate ID */
70  uint16_t carb; /*!< \brief Carbohydrate (SFLOAT) */
71  uint8_t meal; /*!< \brief Meal */
72  uint8_t testerHealth; /*!< \brief Tester and health */
73  uint16_t exerDuration; /*!< \brief Exercise Duration */
74  uint8_t exerIntensity; /*!< \brief Exercise Intensity */
75  uint8_t medicationId; /*!< \brief Medication ID */
76  uint16_t medication; /*!< \brief Medication (SFLOAT) */
77  uint16_t hba1c; /*!< \brief HbA1c */
78 } glpsGlmc_t;
79 
80 /*! \brief Glucose measurement record */
81 typedef struct
82 {
83  glpsGlm_t meas; /*!< \brief Glucose measurement */
84  glpsGlmc_t context; /*!< \brief Glucose measurement context */
85 } glpsRec_t;
86 
87 /*************************************************************************************************/
88 /*!
89  * \brief Initialize the glucose record database.
90  *
91  * \return None.
92  */
93 /*************************************************************************************************/
94 void glpsDbInit(void);
95 
96 /*************************************************************************************************/
97 /*!
98  * \brief Get the next record that matches the given filter parameters that follows
99  * the given current record.
100  *
101  * \param oper Operator.
102  * \param pFilter Glucose service RACP filter parameters.
103  * \param pCurrRec Pointer to current record.
104  * \param pRec Return pointer to next record, if found.
105  *
106  * \return \ref CH_RACP_RSP_SUCCESS if a record is found, otherwise an error status is returned.
107  */
108 /*************************************************************************************************/
109 uint8_t glpsDbGetNextRecord(uint8_t oper, uint8_t *pFilter, glpsRec_t *pCurrRec, glpsRec_t **pRec);
110 
111 /*************************************************************************************************/
112 /*!
113  * \brief Delete records that match the given filter parameters.
114  *
115  * \param oper Operator.
116  * \param pFilter Glucose service RACP filter parameters.
117  *
118  * \return \ref CH_RACP_RSP_SUCCESS if records deleted, otherwise an error status is returned.
119  */
120 /*************************************************************************************************/
122 
123 /*************************************************************************************************/
124 /*!
125  * \brief Get the number of records matching the filter parameters.
126  *
127  * \param oper Operator.
128  * \param pFilter Glucose service RACP filter parameters.
129  * \param pNumRec Returns number of records which match filter parameters.
130 
131  *
132  * \return RACP status.
133  */
134 /*************************************************************************************************/
135 uint8_t glpsDbGetNumRecords(uint8_t oper, uint8_t *pFilter, uint8_t *pNumRec);
136 
137 /*************************************************************************************************/
138 /*!
139 * \brief Generate a new record.
140 *
141 * \return None.
142 */
143 /*************************************************************************************************/
144 void glpsDbGenerateRecord(void);
145 
146 /*************************************************************************************************/
147 /*!
148 * \brief For conformance testing only. Toggle the sample data record number 2's medication
149 * quantity unit flag between Kilograms and Liters. Also modifies quantity.
150 *
151 * \return None.
152 */
153  /*************************************************************************************************/
154 void glpsDbToggleMedicationUnits(void);
155 
156 /*! \} */ /* GLUCOSE_PROFILE */
157 
158 #ifdef __cplusplus
159 };
160 #endif
161 
162 #endif /* GLPS_MAIN_H */
Date and time structure.
Definition: app_hw.h:44
Glucose measurement record.
Definition: glps_main.h:81
uint8_t carbId
Carbohydrate ID.
Definition: glps_main.h:69
uint8_t glpsDbGetNumRecords(uint8_t oper, uint8_t *pFilter, uint8_t *pNumRec)
Get the number of records matching the filter parameters.
uint16_t seqNum
Sequence number.
Definition: glps_main.h:55
uint8_t glpsDbDeleteRecords(uint8_t oper, uint8_t *pFilter)
Delete records that match the given filter parameters.
uint8_t medicationId
Medication ID.
Definition: glps_main.h:75
Application framework hardware interfaces.
uint16_t medication
Medication (SFLOAT)
Definition: glps_main.h:76
uint8_t typeSampleLoc
Sample type and sample location.
Definition: glps_main.h:59
uint8_t flags
Flags.
Definition: glps_main.h:54
void glpsDbInit(void)
Initialize the glucose record database.
void glpsDbToggleMedicationUnits(void)
For conformance testing only. Toggle the sample data record number 2&#39;s medication quantity unit flag ...
uint8_t glpsDbGetNextRecord(uint8_t oper, uint8_t *pFilter, glpsRec_t *pCurrRec, glpsRec_t **pRec)
Get the next record that matches the given filter parameters that follows the given current record...
Glucose measurement structure.
Definition: glps_main.h:52
glpsGlm_t meas
Glucose measurement.
Definition: glps_main.h:83
void glpsDbGenerateRecord(void)
Generate a new record.
uint16_t seqNum
Sequence number.
Definition: glps_main.h:67
uint16_t carb
Carbohydrate (SFLOAT)
Definition: glps_main.h:70
uint8_t exerIntensity
Exercise Intensity.
Definition: glps_main.h:74
glpsGlmc_t context
Glucose measurement context.
Definition: glps_main.h:84
Glucose measurement context structure.
Definition: glps_main.h:64
uint16_t concentration
Glucose concentration (SFLOAT)
Definition: glps_main.h:58
appDateTime_t baseTime
Base time.
Definition: glps_main.h:56
unsigned short uint16_t
Unsigned 16-bit value.
Definition: wsf_types.h:67
uint16_t sensorStatus
Sensor status annunciation.
Definition: glps_main.h:60
uint8_t flags
Flags.
Definition: glps_main.h:66
uint8_t meal
Meal.
Definition: glps_main.h:71
uint8_t testerHealth
Tester and health.
Definition: glps_main.h:72
uint16_t exerDuration
Exercise Duration.
Definition: glps_main.h:73
int16_t timeOffset
Time offset.
Definition: glps_main.h:57
uint8_t extFlags
Extended Flags.
Definition: glps_main.h:68
unsigned char uint8_t
Unsigned 8-bit value.
Definition: wsf_types.h:63
signed short int16_t
Signed 16-bit value.
Definition: wsf_types.h:65
uint16_t hba1c
HbA1c.
Definition: glps_main.h:77