RCBControllerでモータを制御します。うおーるぼっとも動かせました。

Dependencies:   BLE_API TB6612FNG2 mbed nRF51822

Fork of BLE_RCBController2 by Junichi Katsu

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

ライブラリ類をUpdateするとコンパイル出来なくなります。インポートした物をそのまま使って下さい。

RCBControllerでうおーるぼっとを操縦する例 /media/uploads/robo8080/img_1671.jpg

Components / Wallbot
This robot has switch, line sensors and motors. It controls by mbed.

RCBControllerでの操縦は次の4種類あります。 それぞれうおーるぼっとの動きが異なりますので試してみてください。

  • 左十字ボタン
  • 左のみアナログ
  • 右のみアナログ
  • 両方アナログ

うおーるぼっと(LPC1768のソケット)とHRM1017の接続はこれです。

LPC1768 ー HRM1017

p11 ーーー P0_0

p12 ーーー P0_1

p13 ーーー P0_28

p14 ーーー P0_29

p21 ーーー P0_30

p22 ーーー P0_25

GND ーーー GND

/media/uploads/robo8080/img_1711.jpg

/media/uploads/robo8080/img_1703.jpg

HRM1017の電源はうおーるぼっとのUSBコネクタからとります。 /media/uploads/robo8080/img_1674.jpg

Committer:
jksoft
Date:
Wed Aug 20 13:41:01 2014 +0000
Revision:
4:ebda47d22091
Parent:
nRF51822/nordic/nrf-sdk/ble/ble_services/ble_gls.h@1:48f6e08a3ac2
?????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 1:48f6e08a3ac2 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 1:48f6e08a3ac2 2 *
jksoft 1:48f6e08a3ac2 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 1:48f6e08a3ac2 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 1:48f6e08a3ac2 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 1:48f6e08a3ac2 6 *
jksoft 1:48f6e08a3ac2 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 1:48f6e08a3ac2 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 1:48f6e08a3ac2 9 * the file.
jksoft 1:48f6e08a3ac2 10 */
jksoft 1:48f6e08a3ac2 11
jksoft 1:48f6e08a3ac2 12 /** @file
jksoft 1:48f6e08a3ac2 13 *
jksoft 1:48f6e08a3ac2 14 * @defgroup ble_sdk_srv_gls Glucose Service
jksoft 1:48f6e08a3ac2 15 * @{
jksoft 1:48f6e08a3ac2 16 * @ingroup ble_sdk_srv
jksoft 1:48f6e08a3ac2 17 * @brief Glucose Service module.
jksoft 1:48f6e08a3ac2 18 *
jksoft 1:48f6e08a3ac2 19 * @details This module implements the Glucose Service.
jksoft 1:48f6e08a3ac2 20 *
jksoft 1:48f6e08a3ac2 21 * @note The application must propagate BLE stack events to the Glucose Service module by calling
jksoft 1:48f6e08a3ac2 22 * ble_gls_on_ble_evt() from the from the @ref ble_stack_handler callback.
jksoft 1:48f6e08a3ac2 23 *
jksoft 1:48f6e08a3ac2 24 * @note Attention!
jksoft 1:48f6e08a3ac2 25 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
jksoft 1:48f6e08a3ac2 26 * qualification listings, this section of source code must not be modified.
jksoft 1:48f6e08a3ac2 27 */
jksoft 1:48f6e08a3ac2 28
jksoft 1:48f6e08a3ac2 29 #ifndef BLE_GLS_H__
jksoft 1:48f6e08a3ac2 30 #define BLE_GLS_H__
jksoft 1:48f6e08a3ac2 31
jksoft 1:48f6e08a3ac2 32 #include <stdint.h>
jksoft 1:48f6e08a3ac2 33 #include <stdbool.h>
jksoft 1:48f6e08a3ac2 34 #include "ble.h"
jksoft 1:48f6e08a3ac2 35 #include "ble_srv_common.h"
jksoft 1:48f6e08a3ac2 36 #include "ble_date_time.h"
jksoft 1:48f6e08a3ac2 37
jksoft 1:48f6e08a3ac2 38 /**@brief Glucose feature */
jksoft 1:48f6e08a3ac2 39 #define BLE_GLS_FEATURE_LOW_BATT 0x0001 /**< Low Battery Detection During Measurement Supported */
jksoft 1:48f6e08a3ac2 40 #define BLE_GLS_FEATURE_MALFUNC 0x0002 /**< Sensor Malfunction Detection Supported */
jksoft 1:48f6e08a3ac2 41 #define BLE_GLS_FEATURE_SAMPLE_SIZE 0x0004 /**< Sensor Sample Size Supported */
jksoft 1:48f6e08a3ac2 42 #define BLE_GLS_FEATURE_INSERT_ERR 0x0008 /**< Sensor Strip Insertion Error Detection Supported */
jksoft 1:48f6e08a3ac2 43 #define BLE_GLS_FEATURE_TYPE_ERR 0x0010 /**< Sensor Strip Type Error Detection Supported */
jksoft 1:48f6e08a3ac2 44 #define BLE_GLS_FEATURE_RES_HIGH_LOW 0x0020 /**< Sensor Result High-Low Detection Supported */
jksoft 1:48f6e08a3ac2 45 #define BLE_GLS_FEATURE_TEMP_HIGH_LOW 0x0040 /**< Sensor Temperature High-Low Detection Supported */
jksoft 1:48f6e08a3ac2 46 #define BLE_GLS_FEATURE_READ_INT 0x0080 /**< Sensor Read Interrupt Detection Supported */
jksoft 1:48f6e08a3ac2 47 #define BLE_GLS_FEATURE_GENERAL_FAULT 0x0100 /**< General Device Fault Supported */
jksoft 1:48f6e08a3ac2 48 #define BLE_GLS_FEATURE_TIME_FAULT 0x0200 /**< Time Fault Supported */
jksoft 1:48f6e08a3ac2 49 #define BLE_GLS_FEATURE_MULTI_BOND 0x0400 /**< Multiple Bond Supported */
jksoft 1:48f6e08a3ac2 50
jksoft 1:48f6e08a3ac2 51 /**@brief Glucose measurement flags */
jksoft 1:48f6e08a3ac2 52 #define BLE_GLS_MEAS_FLAG_TIME_OFFSET 0x01 /**< Time Offset Present */
jksoft 1:48f6e08a3ac2 53 #define BLE_GLS_MEAS_FLAG_CONC_TYPE_LOC 0x02 /**< Glucose Concentration, Type, and Sample Location Present */
jksoft 1:48f6e08a3ac2 54 #define BLE_GLS_MEAS_FLAG_UNITS_KG_L 0x00 /**< Glucose Concentration Units kg/L */
jksoft 1:48f6e08a3ac2 55 #define BLE_GLS_MEAS_FLAG_UNITS_MOL_L 0x04 /**< Glucose Concentration Units mol/L */
jksoft 1:48f6e08a3ac2 56 #define BLE_GLS_MEAS_FLAG_SENSOR_STATUS 0x08 /**< Sensor Status Annunciation Present */
jksoft 1:48f6e08a3ac2 57 #define BLE_GLS_MEAS_FLAG_CONTEXT_INFO 0x10 /**< Context Information Follows */
jksoft 1:48f6e08a3ac2 58
jksoft 1:48f6e08a3ac2 59 /**@brief Glucose measurement type */
jksoft 1:48f6e08a3ac2 60 #define BLE_GLS_MEAS_TYPE_CAP_BLOOD 1 /**< Capillary whole blood */
jksoft 1:48f6e08a3ac2 61 #define BLE_GLS_MEAS_TYPE_CAP_PLASMA 2 /**< Capillary plasma */
jksoft 1:48f6e08a3ac2 62 #define BLE_GLS_MEAS_TYPE_VEN_BLOOD 3 /**< Venous whole blood */
jksoft 1:48f6e08a3ac2 63 #define BLE_GLS_MEAS_TYPE_VEN_PLASMA 4 /**< Venous plasma */
jksoft 1:48f6e08a3ac2 64 #define BLE_GLS_MEAS_TYPE_ART_BLOOD 5 /**< Arterial whole blood */
jksoft 1:48f6e08a3ac2 65 #define BLE_GLS_MEAS_TYPE_ART_PLASMA 6 /**< Arterial plasma */
jksoft 1:48f6e08a3ac2 66 #define BLE_GLS_MEAS_TYPE_UNDET_BLOOD 7 /**< Undetermined whole blood */
jksoft 1:48f6e08a3ac2 67 #define BLE_GLS_MEAS_TYPE_UNDET_PLASMA 8 /**< Undetermined plasma */
jksoft 1:48f6e08a3ac2 68 #define BLE_GLS_MEAS_TYPE_FLUID 9 /**< Interstitial fluid (ISF) */
jksoft 1:48f6e08a3ac2 69 #define BLE_GLS_MEAS_TYPE_CONTROL 10 /**< Control solution */
jksoft 1:48f6e08a3ac2 70
jksoft 1:48f6e08a3ac2 71 /**@brief Glucose measurement location */
jksoft 1:48f6e08a3ac2 72 #define BLE_GLS_MEAS_LOC_FINGER 1 /**< Finger */
jksoft 1:48f6e08a3ac2 73 #define BLE_GLS_MEAS_LOC_AST 2 /**< Alternate Site Test (AST) */
jksoft 1:48f6e08a3ac2 74 #define BLE_GLS_MEAS_LOC_EAR 3 /**< Earlobe */
jksoft 1:48f6e08a3ac2 75 #define BLE_GLS_MEAS_LOC_CONTROL 4 /**< Control solution */
jksoft 1:48f6e08a3ac2 76 #define BLE_GLS_MEAS_LOC_NOT_AVAIL 15 /**< Sample Location value not available */
jksoft 1:48f6e08a3ac2 77
jksoft 1:48f6e08a3ac2 78 /**@brief Glucose sensor status annunciation */
jksoft 1:48f6e08a3ac2 79 #define BLE_GLS_MEAS_STATUS_BATT_LOW 0x0001 /**< Device battery low at time of measurement */
jksoft 1:48f6e08a3ac2 80 #define BLE_GLS_MEAS_STATUS_SENSOR_FAULT 0x0002 /**< Sensor malfunction or faulting at time of measurement */
jksoft 1:48f6e08a3ac2 81 #define BLE_GLS_MEAS_STATUS_SAMPLE_SIZE 0x0004 /**< Sample size for blood or control solution insufficient at time of measurement */
jksoft 1:48f6e08a3ac2 82 #define BLE_GLS_MEAS_STATUS_STRIP_INSERT 0x0008 /**< Strip insertion error */
jksoft 1:48f6e08a3ac2 83 #define BLE_GLS_MEAS_STATUS_STRIP_TYPE 0x0010 /**< Strip type incorrect for device */
jksoft 1:48f6e08a3ac2 84 #define BLE_GLS_MEAS_STATUS_RESULT_HIGH 0x0020 /**< Sensor result higher than the device can process */
jksoft 1:48f6e08a3ac2 85 #define BLE_GLS_MEAS_STATUS_RESULT_LOW 0x0040 /**< Sensor result lower than the device can process */
jksoft 1:48f6e08a3ac2 86 #define BLE_GLS_MEAS_STATUS_TEMP_HIGH 0x0080 /**< Sensor temperature too high for valid test/result at time of measurement */
jksoft 1:48f6e08a3ac2 87 #define BLE_GLS_MEAS_STATUS_TEMP_LOW 0x0100 /**< Sensor temperature too low for valid test/result at time of measurement */
jksoft 1:48f6e08a3ac2 88 #define BLE_GLS_MEAS_STATUS_STRIP_PULL 0x0200 /**< Sensor read interrupted because strip was pulled too soon at time of measurement */
jksoft 1:48f6e08a3ac2 89 #define BLE_GLS_MEAS_STATUS_GENERAL_FAULT 0x0400 /**< General device fault has occurred in the sensor */
jksoft 1:48f6e08a3ac2 90 #define BLE_GLS_MEAS_STATUS_TIME_FAULT 0x0800 /**< Time fault has occurred in the sensor and time may be inaccurate */
jksoft 1:48f6e08a3ac2 91
jksoft 1:48f6e08a3ac2 92 /**@brief Glucose measurement context flags */
jksoft 1:48f6e08a3ac2 93 #define BLE_GLS_CONTEXT_FLAG_CARB 0x01 /**< Carbohydrate id and carbohydrate present */
jksoft 1:48f6e08a3ac2 94 #define BLE_GLS_CONTEXT_FLAG_MEAL 0x02 /**< Meal present */
jksoft 1:48f6e08a3ac2 95 #define BLE_GLS_CONTEXT_FLAG_TESTER 0x04 /**< Tester-health present */
jksoft 1:48f6e08a3ac2 96 #define BLE_GLS_CONTEXT_FLAG_EXERCISE 0x08 /**< Exercise duration and exercise intensity present */
jksoft 1:48f6e08a3ac2 97 #define BLE_GLS_CONTEXT_FLAG_MED 0x10 /**< Medication ID and medication present */
jksoft 1:48f6e08a3ac2 98 #define BLE_GLS_CONTEXT_FLAG_MED_KG 0x00 /**< Medication value units, kilograms */
jksoft 1:48f6e08a3ac2 99 #define BLE_GLS_CONTEXT_FLAG_MED_L 0x20 /**< Medication value units, liters */
jksoft 1:48f6e08a3ac2 100 #define BLE_GLS_CONTEXT_FLAG_HBA1C 0x40 /**< Hba1c present */
jksoft 1:48f6e08a3ac2 101 #define BLE_GLS_CONTEXT_FLAG_EXT 0x80 /**< Extended flags present */
jksoft 1:48f6e08a3ac2 102
jksoft 1:48f6e08a3ac2 103 /**@brief Glucose measurement context carbohydrate ID */
jksoft 1:48f6e08a3ac2 104 #define BLE_GLS_CONTEXT_CARB_BREAKFAST 1 /**< Breakfast */
jksoft 1:48f6e08a3ac2 105 #define BLE_GLS_CONTEXT_CARB_LUNCH 2 /**< Lunch */
jksoft 1:48f6e08a3ac2 106 #define BLE_GLS_CONTEXT_CARB_DINNER 3 /**< Dinner */
jksoft 1:48f6e08a3ac2 107 #define BLE_GLS_CONTEXT_CARB_SNACK 4 /**< Snack */
jksoft 1:48f6e08a3ac2 108 #define BLE_GLS_CONTEXT_CARB_DRINK 5 /**< Drink */
jksoft 1:48f6e08a3ac2 109 #define BLE_GLS_CONTEXT_CARB_SUPPER 6 /**< Supper */
jksoft 1:48f6e08a3ac2 110 #define BLE_GLS_CONTEXT_CARB_BRUNCH 7 /**< Brunch */
jksoft 1:48f6e08a3ac2 111
jksoft 1:48f6e08a3ac2 112 /**@brief Glucose measurement context meal */
jksoft 1:48f6e08a3ac2 113 #define BLE_GLS_CONTEXT_MEAL_PREPRANDIAL 1 /**< Preprandial (before meal) */
jksoft 1:48f6e08a3ac2 114 #define BLE_GLS_CONTEXT_MEAL_POSTPRANDIAL 2 /**< Postprandial (after meal) */
jksoft 1:48f6e08a3ac2 115 #define BLE_GLS_CONTEXT_MEAL_FASTING 3 /**< Fasting */
jksoft 1:48f6e08a3ac2 116 #define BLE_GLS_CONTEXT_MEAL_CASUAL 4 /**< Casual (snacks, drinks, etc.) */
jksoft 1:48f6e08a3ac2 117 #define BLE_GLS_CONTEXT_MEAL_BEDTIME 5 /**< Bedtime */
jksoft 1:48f6e08a3ac2 118
jksoft 1:48f6e08a3ac2 119 /**@brief Glucose measurement context tester */
jksoft 1:48f6e08a3ac2 120 #define BLE_GLS_CONTEXT_TESTER_SELF 1 /**< Self */
jksoft 1:48f6e08a3ac2 121 #define BLE_GLS_CONTEXT_TESTER_PRO 2 /**< Health care professional */
jksoft 1:48f6e08a3ac2 122 #define BLE_GLS_CONTEXT_TESTER_LAB 3 /**< Lab test */
jksoft 1:48f6e08a3ac2 123 #define BLE_GLS_CONTEXT_TESTER_NOT_AVAIL 15 /**< Tester value not available */
jksoft 1:48f6e08a3ac2 124
jksoft 1:48f6e08a3ac2 125 /**@brief Glucose measurement context health */
jksoft 1:48f6e08a3ac2 126 #define BLE_GLS_CONTEXT_HEALTH_MINOR 1 /**< Minor health issues */
jksoft 1:48f6e08a3ac2 127 #define BLE_GLS_CONTEXT_HEALTH_MAJOR 2 /**< Major health issues */
jksoft 1:48f6e08a3ac2 128 #define BLE_GLS_CONTEXT_HEALTH_MENSES 3 /**< During menses */
jksoft 1:48f6e08a3ac2 129 #define BLE_GLS_CONTEXT_HEALTH_STRESS 4 /**< Under stress */
jksoft 1:48f6e08a3ac2 130 #define BLE_GLS_CONTEXT_HEALTH_NONE 5 /**< No health issues */
jksoft 1:48f6e08a3ac2 131 #define BLE_GLS_CONTEXT_HEALTH_NOT_AVAIL 15 /**< Health value not available */
jksoft 1:48f6e08a3ac2 132
jksoft 1:48f6e08a3ac2 133 /**@brief Glucose measurement context medication ID */
jksoft 1:48f6e08a3ac2 134 #define BLE_GLS_CONTEXT_MED_RAPID 1 /**< Rapid acting insulin */
jksoft 1:48f6e08a3ac2 135 #define BLE_GLS_CONTEXT_MED_SHORT 2 /**< Short acting insulin */
jksoft 1:48f6e08a3ac2 136 #define BLE_GLS_CONTEXT_MED_INTERMED 3 /**< Intermediate acting insulin */
jksoft 1:48f6e08a3ac2 137 #define BLE_GLS_CONTEXT_MED_LONG 4 /**< Long acting insulin */
jksoft 1:48f6e08a3ac2 138 #define BLE_GLS_CONTEXT_MED_PREMIX 5 /**< Pre-mixed insulin */
jksoft 1:48f6e08a3ac2 139
jksoft 1:48f6e08a3ac2 140 /**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) */
jksoft 1:48f6e08a3ac2 141 typedef struct
jksoft 1:48f6e08a3ac2 142 {
jksoft 1:48f6e08a3ac2 143 int8_t exponent; /**< Base 10 exponent, should be using only 4 bits */
jksoft 1:48f6e08a3ac2 144 int16_t mantissa; /**< Mantissa, should be using only 12 bits */
jksoft 1:48f6e08a3ac2 145 } sfloat_t;
jksoft 1:48f6e08a3ac2 146
jksoft 1:48f6e08a3ac2 147 /**@brief Glucose Service event type. */
jksoft 1:48f6e08a3ac2 148 typedef enum
jksoft 1:48f6e08a3ac2 149 {
jksoft 1:48f6e08a3ac2 150 BLE_GLS_EVT_NOTIFICATION_ENABLED, /**< Glucose value notification enabled event. */
jksoft 1:48f6e08a3ac2 151 BLE_GLS_EVT_NOTIFICATION_DISABLED /**< Glucose value notification disabled event. */
jksoft 1:48f6e08a3ac2 152 } ble_gls_evt_type_t;
jksoft 1:48f6e08a3ac2 153
jksoft 1:48f6e08a3ac2 154 /**@brief Glucose Service event. */
jksoft 1:48f6e08a3ac2 155 typedef struct
jksoft 1:48f6e08a3ac2 156 {
jksoft 1:48f6e08a3ac2 157 ble_gls_evt_type_t evt_type; /**< Type of event. */
jksoft 1:48f6e08a3ac2 158 } ble_gls_evt_t;
jksoft 1:48f6e08a3ac2 159
jksoft 1:48f6e08a3ac2 160 // Forward declaration of the ble_gls_t type.
jksoft 1:48f6e08a3ac2 161 typedef struct ble_gls_s ble_gls_t;
jksoft 1:48f6e08a3ac2 162
jksoft 1:48f6e08a3ac2 163 /**@brief Glucose Service event handler type. */
jksoft 1:48f6e08a3ac2 164 typedef void (*ble_gls_evt_handler_t) (ble_gls_t * p_gls, ble_gls_evt_t * p_evt);
jksoft 1:48f6e08a3ac2 165
jksoft 1:48f6e08a3ac2 166 /**@brief Glucose Measurement structure. This contains glucose measurement value. */
jksoft 1:48f6e08a3ac2 167 typedef struct
jksoft 1:48f6e08a3ac2 168 {
jksoft 1:48f6e08a3ac2 169 uint8_t flags; /**< Flags */
jksoft 1:48f6e08a3ac2 170 uint16_t sequence_number; /**< Sequence number */
jksoft 1:48f6e08a3ac2 171 ble_date_time_t base_time; /**< Time stamp */
jksoft 1:48f6e08a3ac2 172 int16_t time_offset; /**< Time offset */
jksoft 1:48f6e08a3ac2 173 sfloat_t glucose_concentration; /**< Glucose concentration */
jksoft 1:48f6e08a3ac2 174 uint8_t type; /**< Type */
jksoft 1:48f6e08a3ac2 175 uint8_t sample_location; /**< Sample location */
jksoft 1:48f6e08a3ac2 176 uint16_t sensor_status_annunciation; /**< Sensor status annunciation */
jksoft 1:48f6e08a3ac2 177 } ble_gls_meas_t;
jksoft 1:48f6e08a3ac2 178
jksoft 1:48f6e08a3ac2 179 /**@brief Glucose measurement context structure */
jksoft 1:48f6e08a3ac2 180 typedef struct
jksoft 1:48f6e08a3ac2 181 {
jksoft 1:48f6e08a3ac2 182 uint8_t flags; /**< Flags */
jksoft 1:48f6e08a3ac2 183 uint8_t extended_flags; /**< Extended Flags */
jksoft 1:48f6e08a3ac2 184 uint8_t carbohydrate_id; /**< Carbohydrate ID */
jksoft 1:48f6e08a3ac2 185 sfloat_t carbohydrate; /**< Carbohydrate */
jksoft 1:48f6e08a3ac2 186 uint8_t meal; /**< Meal */
jksoft 1:48f6e08a3ac2 187 uint8_t tester_and_health; /**< Tester and health */
jksoft 1:48f6e08a3ac2 188 uint16_t exercise_duration; /**< Exercise Duration */
jksoft 1:48f6e08a3ac2 189 uint8_t exercise_intensity; /**< Exercise Intensity */
jksoft 1:48f6e08a3ac2 190 uint8_t medication_id; /**< Medication ID */
jksoft 1:48f6e08a3ac2 191 sfloat_t medication; /**< Medication */
jksoft 1:48f6e08a3ac2 192 uint16_t hba1c; /**< HbA1c */
jksoft 1:48f6e08a3ac2 193 } ble_gls_meas_context_t;
jksoft 1:48f6e08a3ac2 194
jksoft 1:48f6e08a3ac2 195 /**@brief Glucose measurement record */
jksoft 1:48f6e08a3ac2 196 typedef struct
jksoft 1:48f6e08a3ac2 197 {
jksoft 1:48f6e08a3ac2 198 ble_gls_meas_t meas; /**< Glucose measurement */
jksoft 1:48f6e08a3ac2 199 ble_gls_meas_context_t context; /**< Glucose measurement context */
jksoft 1:48f6e08a3ac2 200 } ble_gls_rec_t;
jksoft 1:48f6e08a3ac2 201
jksoft 1:48f6e08a3ac2 202 /**@brief Glucose Service init structure. This contains all options and data needed for
jksoft 1:48f6e08a3ac2 203 * initialization of the service. */
jksoft 1:48f6e08a3ac2 204 typedef struct
jksoft 1:48f6e08a3ac2 205 {
jksoft 1:48f6e08a3ac2 206 ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */
jksoft 1:48f6e08a3ac2 207 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
jksoft 1:48f6e08a3ac2 208 uint16_t feature; /**< Glucose Feature value indicating supported features. */
jksoft 1:48f6e08a3ac2 209 bool is_context_supported; /**< Determines if optional Glucose Measurement Context is to be supported. */
jksoft 1:48f6e08a3ac2 210 } ble_gls_init_t;
jksoft 1:48f6e08a3ac2 211
jksoft 1:48f6e08a3ac2 212 /**@brief Glucose Service structure. This contains various status information for the service. */
jksoft 1:48f6e08a3ac2 213 typedef struct ble_gls_s
jksoft 1:48f6e08a3ac2 214 {
jksoft 1:48f6e08a3ac2 215 ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */
jksoft 1:48f6e08a3ac2 216 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
jksoft 1:48f6e08a3ac2 217 uint16_t service_handle; /**< Handle of Glucose Service (as provided by the BLE stack). */
jksoft 1:48f6e08a3ac2 218 ble_gatts_char_handles_t glm_handles; /**< Handles related to the Glucose Measurement characteristic. */
jksoft 1:48f6e08a3ac2 219 ble_gatts_char_handles_t glm_context_handles; /**< Handles related to the Glucose Measurement Context characteristic. */
jksoft 1:48f6e08a3ac2 220 ble_gatts_char_handles_t glf_handles; /**< Handles related to the Glucose Feature characteristic. */
jksoft 1:48f6e08a3ac2 221 ble_gatts_char_handles_t racp_handles; /**< Handles related to the Record Access Control Point characteristic. */
jksoft 1:48f6e08a3ac2 222 uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */
jksoft 1:48f6e08a3ac2 223 uint16_t feature;
jksoft 1:48f6e08a3ac2 224 bool is_context_supported;
jksoft 1:48f6e08a3ac2 225 } ble_gls_t;
jksoft 1:48f6e08a3ac2 226
jksoft 1:48f6e08a3ac2 227 /**@brief Function for initializing the Glucose Service.
jksoft 1:48f6e08a3ac2 228 *
jksoft 1:48f6e08a3ac2 229 * @details This call allows the application to initialize the Glucose Service.
jksoft 1:48f6e08a3ac2 230 *
jksoft 1:48f6e08a3ac2 231 * @param[out] p_gls Glucose Service structure. This structure will have to be supplied by
jksoft 1:48f6e08a3ac2 232 * the application. It will be initialized by this function, and will later
jksoft 1:48f6e08a3ac2 233 * be used to identify this particular service instance.
jksoft 1:48f6e08a3ac2 234 * @param[in] p_gls_init Information needed to initialize the service.
jksoft 1:48f6e08a3ac2 235 *
jksoft 1:48f6e08a3ac2 236 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
jksoft 1:48f6e08a3ac2 237 */
jksoft 1:48f6e08a3ac2 238 uint32_t ble_gls_init(ble_gls_t * p_gls, const ble_gls_init_t * p_gls_init);
jksoft 1:48f6e08a3ac2 239
jksoft 1:48f6e08a3ac2 240 /**@brief Function for handling the Application's BLE Stack events.
jksoft 1:48f6e08a3ac2 241 *
jksoft 1:48f6e08a3ac2 242 * @details Handles all events from the BLE stack of interest to the Glucose Service.
jksoft 1:48f6e08a3ac2 243 *
jksoft 1:48f6e08a3ac2 244 * @param[in] p_gls Glucose Service structure.
jksoft 1:48f6e08a3ac2 245 * @param[in] p_ble_evt Event received from the BLE stack.
jksoft 1:48f6e08a3ac2 246 */
jksoft 1:48f6e08a3ac2 247 void ble_gls_on_ble_evt(ble_gls_t * p_gls, ble_evt_t * p_ble_evt);
jksoft 1:48f6e08a3ac2 248
jksoft 1:48f6e08a3ac2 249 /**@brief Function for reporting a new glucose measurement to the glucose service module.
jksoft 1:48f6e08a3ac2 250 *
jksoft 1:48f6e08a3ac2 251 * @details The application calls this function after having performed a new glucose measurement.
jksoft 1:48f6e08a3ac2 252 * The new measurement is recorded in the RACP database.
jksoft 1:48f6e08a3ac2 253 *
jksoft 1:48f6e08a3ac2 254 * @param[in] p_gls Glucose Service structure.
jksoft 1:48f6e08a3ac2 255 * @param[in] p_rec Pointer to glucose record (measurement plus context).
jksoft 1:48f6e08a3ac2 256 *
jksoft 1:48f6e08a3ac2 257 * @return NRF_SUCCESS on success, otherwise an error code.
jksoft 1:48f6e08a3ac2 258 */
jksoft 1:48f6e08a3ac2 259 uint32_t ble_gls_glucose_new_meas(ble_gls_t * p_gls, ble_gls_rec_t * p_rec);
jksoft 1:48f6e08a3ac2 260
jksoft 1:48f6e08a3ac2 261 #endif // BLE_GLS_H__
jksoft 1:48f6e08a3ac2 262
jksoft 1:48f6e08a3ac2 263 /** @} */
jksoft 1:48f6e08a3ac2 264
jksoft 1:48f6e08a3ac2 265 /** @endcond */