北海道情報専門学校 ライフハック研究所のエンベデッドUSBチーム松葉和仁により開発されたUSBSecのmbedに使用するソースコード by 和仁

Dependencies:   SDFileSystem MusicEngine

Fork of mbed-os-example-ble-LED by mbed-os-examples

北海道情報専門学校 ライフハック研究所 エンベデッドUSB USBSec用mbedプログラム

松葉和仁

source/PINService.h

Committer:
kazu0o2
Date:
2017-02-08
Revision:
37:dcb097426442
Parent:
14:be4e43ce1578

File content as of revision 37:dcb097426442:

#ifndef __BLE_PIN_SERVICE_H__
#define __BLE_PIN_SERVICE_H__

class PINService {
public:
    const static uint16_t PIN_SERVICE_UUID              = 0xA002;
    const static uint16_t PIN_STATE_CHARACTERISTIC_UUID = 0xA021;

    PINService(BLEDevice &_ble, char initialValueForPINCharacteristic[]) :
        ble(_ble), pinState(PIN_STATE_CHARACTERISTIC_UUID, &initialValueForPINCharacteristic[0])
    {
        GattCharacteristic *charTable[] = {&pinState};
        GattService         pinService(PIN_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
        ble.addService(pinService);
    }

    GattAttribute::Handle_t getValueHandle() const
    {
        return pinState.getValueHandle();
    }

private:
    BLEDevice                         &ble;
    WriteOnlyArrayGattCharacteristic<char,6> pinState;
};

#endif /* #ifndef __BLE_PIN_SERVICE_H__ */