This is a basic code to be used for Sequana BLE Lab exercises.

Committer:
lru
Date:
Thu Mar 14 13:25:02 2019 +0000
Revision:
2:06e62a299a74
Parent:
0:ff033dfc838b
Updated acc/mag sensor naming.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lru 0:ff033dfc838b 1 /*
lru 0:ff033dfc838b 2 * Copyright (c) 2017-2019 Future Electronics
lru 0:ff033dfc838b 3 *
lru 0:ff033dfc838b 4 * Licensed under the Apache License, Version 2.0 (the "License");
lru 0:ff033dfc838b 5 * you may not use this file except in compliance with the License.
lru 0:ff033dfc838b 6 * You may obtain a copy of the License at
lru 0:ff033dfc838b 7 *
lru 0:ff033dfc838b 8 * http://www.apache.org/licenses/LICENSE-2.0
lru 0:ff033dfc838b 9 *
lru 0:ff033dfc838b 10 * Unless required by applicable law or agreed to in writing, software
lru 0:ff033dfc838b 11 * distributed under the License is distributed on an "AS IS" BASIS,
lru 0:ff033dfc838b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lru 0:ff033dfc838b 13 * See the License for the specific language governing permissions and
lru 0:ff033dfc838b 14 * limitations under the License.
lru 0:ff033dfc838b 15 */
lru 0:ff033dfc838b 16
lru 0:ff033dfc838b 17 #ifndef SEQUANAPRIMARYSERVICE_H__
lru 0:ff033dfc838b 18 #define SEQUANAPRIMARYSERVICE_H__
lru 0:ff033dfc838b 19
lru 0:ff033dfc838b 20 #include "ble/BLE.h"
lru 0:ff033dfc838b 21 #include "UUID.h"
lru 0:ff033dfc838b 22 #include "Sensor.h"
lru 0:ff033dfc838b 23 #include "SensorCharacteristic.h"
lru 2:06e62a299a74 24 #include "Kmx65.h"
lru 0:ff033dfc838b 25
lru 0:ff033dfc838b 26 namespace sequana {
lru 0:ff033dfc838b 27
lru 0:ff033dfc838b 28 /* Instantiation of binary buffers for characteristics values */
lru 2:06e62a299a74 29 typedef CharBuffer<Kmx65Value, 12> Kmx65CharBuffer;
lru 0:ff033dfc838b 30
lru 0:ff033dfc838b 31
lru 0:ff033dfc838b 32
lru 0:ff033dfc838b 33 /** Sequana BLE Primary Service. This service provides data obtained from Sequana and Sequana Environmental Shield sensors.
lru 0:ff033dfc838b 34 */
lru 0:ff033dfc838b 35 class PrimaryService {
lru 0:ff033dfc838b 36 public:
lru 0:ff033dfc838b 37 static const UUID UUID_SEQUANA_PRIMARY_SERVICE;
lru 0:ff033dfc838b 38
lru 0:ff033dfc838b 39 public:
lru 0:ff033dfc838b 40 /** Add Sequana Primary Service to an existing BLE object, initializing it with all characteristics.
lru 0:ff033dfc838b 41 * @param ble Reference to the BLE device.
lru 2:06e62a299a74 42 * @param accmag_sensor Reference to KMX65 sensor.
lru 0:ff033dfc838b 43 */
lru 0:ff033dfc838b 44 PrimaryService(BLE &ble,
lru 2:06e62a299a74 45 Kmx65Sensor &accmag_sensor );
lru 0:ff033dfc838b 46
lru 0:ff033dfc838b 47 protected:
lru 0:ff033dfc838b 48 BLE &_ble;
lru 2:06e62a299a74 49 SensorMultiCharacteristic<2, Kmx65CharBuffer, Kmx65Value> _accMagSensorMeasurement;
lru 0:ff033dfc838b 50 };
lru 0:ff033dfc838b 51
lru 0:ff033dfc838b 52 } //namespace
lru 0:ff033dfc838b 53
lru 0:ff033dfc838b 54 #endif // SEQUANAPRIMARYSERVICE_H__