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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SequanaPrimaryService.h Source File

SequanaPrimaryService.h

00001 /*
00002  * Copyright (c) 2017-2019 Future Electronics
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef SEQUANAPRIMARYSERVICE_H__
00018 #define SEQUANAPRIMARYSERVICE_H__
00019 
00020 #include "ble/BLE.h"
00021 #include "UUID.h"
00022 #include "Sensor.h"
00023 #include "SensorCharacteristic.h"
00024 #include "Kmx65.h"
00025 
00026 namespace sequana {
00027 
00028 /* Instantiation of binary buffers for characteristics values */
00029 typedef CharBuffer<Kmx65Value, 12>  Kmx65CharBuffer;
00030 
00031 
00032 
00033 /** Sequana BLE Primary Service. This service provides data obtained from Sequana and Sequana Environmental Shield sensors.
00034  */
00035 class PrimaryService {
00036 public:
00037     static const UUID UUID_SEQUANA_PRIMARY_SERVICE;
00038 
00039 public:
00040     /** Add Sequana Primary Service to an existing BLE object, initializing it with all characteristics.
00041      * @param ble                   Reference to the BLE device.
00042      * @param accmag_sensor         Reference to KMX65 sensor.
00043      */
00044     PrimaryService(BLE &ble,
00045                    Kmx65Sensor &accmag_sensor );
00046 
00047 protected:
00048     BLE &_ble;
00049     SensorMultiCharacteristic<2, Kmx65CharBuffer, Kmx65Value>    _accMagSensorMeasurement;
00050 };
00051 
00052 } //namespace
00053 
00054 #endif // SEQUANAPRIMARYSERVICE_H__