This commit is contained in:
hathach committed 2017-10-16 16:26:48 +07:00
1 parent 988ed2d37f
commit 83369ec255
5 files changed
+36 -7

No files matched your search

@@ -37,8 +37,14 @@
#include <bluefruit.h>
#include "BLEHomekit.h"
BLEUuid HAPCharacteristic::_g_uuid_cid(HAP_UUID_CHR_CHARACTERISTIC_ID);
BLEUuid HAPCharacteristic::_g_uuid_cid(HAP_UUID_DSC_CHARACTERISTIC_ID);
/**
*
* @param bleuuid Uuid of the characteristic
* @param format BLE_GATT_CPF_FORMAT_x value, see ble_gatt.h
* @param unit UUID16_UNIT_x, see BLEUuid.h
*/
HAPCharacteristic::HAPCharacteristic(BLEUuid bleuuid, uint8_t format, uint16_t unit)
: BLECharacteristic(bleuuid)
{
@@ -80,7 +86,7 @@ err_t HAPCharacteristic::_addChrIdDescriptor(void)
err_t HAPCharacteristic::_addHapDescriptor(void)
{
HAPCharacteristic
return ERROR_NONE;
}
+13 -2
View File
@@ -36,7 +36,7 @@
#ifndef HAPPROCEDURE_H_
#define HAPPROCEDURE_H_
enum HAPOpcode
enum HAPOpcode_t
{
HAP_OPCODE_CHR_SIGNATURE_READ = 0x01 ,
HAP_OPCODE_CHR_WRITE ,
@@ -46,7 +46,7 @@ enum HAPOpcode
HAP_OPCODE_SVC_SIGNATURE_READ
};
enum HAPParamType
enum HAPParamType_t
{
HAP_PARAM_VALUE = 1 ,
HAP_PARAM_ADDITIONAL_AUTHORIZATION_DATA ,
@@ -68,6 +68,17 @@ enum HAPParamType
HAP_PARAM_HAP_VALID_VALUES_RANGE_DESC
};
enum HAPStatusCode_t
{
HAP_STATUS_SUCCESS = 0 ,
HAP_STATUS_UNSUPPORTED_PDU ,
HAP_STATUS_MAX_PROCEDURES ,
HAP_STATUS_INSUFFICIENT_AUTHORIZATION ,
HAP_STATUS_INVALID_INSTANCE_ID ,
HAP_STATUS_INSUFFICIENT_AUTHENTICATION ,
HAP_STATUS_INVALID_REQUEST
};
struct ATTR_PACKED
{
uint8_t fragment : 1; // 0 : first Fragment (or no fragment), 1 : Continuation of Fragment
+8 -1
View File
@@ -64,4 +64,11 @@ err_t HAPService::_addSvcID(void)
return ERROR_NONE;
}
//err_t HAPService::addSignatureChr(void)
//{
// _signature = new HAPCharacteristic(HAP_UUID_CHR_SERVICE_SIGNATURE, BLE_GATT_CPF_FORMAT_STRUCT);
// VERIFY( _signature, NRF_ERROR_NO_MEM);
//
// _signature->setProperties(CHR_PROPS_READ | CHR_PROPS_WRITE);
//
//}
+6 -1
View File
@@ -37,16 +37,21 @@
#define HAPSERVICE_H_
#include <BLEService.h>
#include "HAPCharacteristic.h"
class HAPService : public BLEService
{
public:
HAPService(BLEUuid bleuuid) : BLEService(bleuuid) { _svc_id = 0; }
HAPService(BLEUuid bleuuid) : BLEService(bleuuid) { _svc_id = 0; /*_signature = NULL;*/ }
virtual err_t begin(void);
err_t addSignatureChr(void);
private:
uint16_t _svc_id;
// HAPCharacteristic* _signature;
// Service Instance ID
err_t _addSvcID(void);
+1 -1
View File
@@ -37,7 +37,7 @@
#define HAPUUID_H_
#define HAP_UUID_CHR_SERVICE_ID ((const uint8_t[]) { 0xD1, 0xA0, 0x83, 0x50, 0x00, 0xAA, 0xD3, 0x87, 0x17, 0x48, 0x59, 0xA7, 0x5D, 0xE9, 0x04, 0xE6 })
#define HAP_UUID_CHR_CHARACTERISTIC_ID ((const uint8_t[]) { 0x9A, 0x93, 0x96, 0xD7, 0xBD, 0x6A, 0xD9, 0xB5, 0x16, 0x46, 0xD2, 0x81, 0xFE, 0xF0, 0x46, 0xDC })
#define HAP_UUID_DSC_CHARACTERISTIC_ID ((const uint8_t[]) { 0x9A, 0x93, 0x96, 0xD7, 0xBD, 0x6A, 0xD9, 0xB5, 0x16, 0x46, 0xD2, 0x81, 0xFE, 0xF0, 0x46, 0xDC })
#define HAP_UUID_CHR_SERVICE_SIGNATURE ((const uint8_t[]) { 0x91, 0x52, 0x76, 0xBB, 0x26, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xA5, 0x00, 0x00, 0x00 })
/*------------------------------------------------------------------*/