update hap char
This commit is contained in:
1 parent
76a366f94c
commit
af749ca328
5 files changed
+24
-19
No files matched your search
@@ -36,6 +36,7 @@
|
||||
#ifndef BLEHOMEKIT_H_
|
||||
#define BLEHOMEKIT_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "HAPUuid.h"
|
||||
#include "HAPProcedure.h"
|
||||
#include "HAPCharacteristic.h"
|
||||
|
||||
@@ -61,15 +61,15 @@ class HAPCharacteristic : public BLECharacteristic
|
||||
|
||||
void setHapProperties(uint16_t prop);
|
||||
|
||||
/*------------- Internal Functions -------------*/
|
||||
virtual void _eventHandler(ble_evt_t* event);
|
||||
|
||||
private:
|
||||
uint16_t _cid;
|
||||
uint16_t _hap_props;
|
||||
|
||||
err_t _addChrIdDescriptor (void);
|
||||
err_t _addHapDescriptor(void);
|
||||
|
||||
virtual void _eventHandler(ble_evt_t* event);
|
||||
|
||||
err_t _addChrIdDescriptor(void);
|
||||
err_t _addHapDescriptor (void);
|
||||
};
|
||||
|
||||
#endif /* HAPCHARACTERISTIC_H_ */
|
||||
@@ -117,9 +117,9 @@ enum TLVType_t
|
||||
|
||||
typedef struct ATTR_PACKED
|
||||
{
|
||||
uint8_t type; // TLVType_t
|
||||
uint8_t length;
|
||||
uint8_t value[];
|
||||
uint8_t type;
|
||||
uint8_t len;
|
||||
const void* value; // need serialization, not reflect physical layout
|
||||
}TLV8_t;
|
||||
|
||||
typedef struct ATTR_PACKED
|
||||
@@ -127,11 +127,13 @@ typedef struct ATTR_PACKED
|
||||
uint8_t fragment : 1; // 0 : first Fragment (or no fragment), 1 : Continuation of Fragment
|
||||
uint8_t : 3; // reserved
|
||||
uint8_t type : 3; // 0b000 : request, 0b001 : response
|
||||
uint8_t lenext : 1;
|
||||
uint8_t lenext : 1; // not used
|
||||
} HAPControl_t;
|
||||
|
||||
VERIFY_STATIC(sizeof (HAPControl_t) == 1);
|
||||
|
||||
/*------------- Request -------------*/
|
||||
|
||||
typedef struct ATTR_PACKED
|
||||
{
|
||||
HAPControl_t control ;
|
||||
@@ -146,11 +148,13 @@ typedef struct ATTR_PACKED
|
||||
{
|
||||
HAPRequestHeader_t header;
|
||||
|
||||
// Optional
|
||||
uint16_t len;
|
||||
uint8_t tlvdata[1];
|
||||
// Body (optional)
|
||||
uint16_t body_len;
|
||||
uint8_t body_data[1];
|
||||
} HAPRequest_t;
|
||||
|
||||
/*------------- Response -------------*/
|
||||
|
||||
typedef struct ATTR_PACKED
|
||||
{
|
||||
HAPControl_t control;
|
||||
@@ -160,14 +164,13 @@ typedef struct ATTR_PACKED
|
||||
|
||||
VERIFY_STATIC(sizeof (HAPResponseHeader_t) == 3);
|
||||
|
||||
|
||||
typedef struct ATTR_PACKED
|
||||
{
|
||||
HAPResponseHeader_t header;
|
||||
|
||||
// Optional
|
||||
uint16_t len;
|
||||
uint8_t tlvdata[1];
|
||||
// Body (optional)
|
||||
uint16_t body_len;
|
||||
uint8_t body_data[1];
|
||||
} HAPResponse_t;
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class HAPService : public BLEService
|
||||
virtual err_t begin(void);
|
||||
|
||||
err_t addSignatureChr(void);
|
||||
uint16_t getSvcId(void) { return _svc_id; }
|
||||
|
||||
private:
|
||||
uint16_t _svc_id;
|
||||
|
||||
@@ -140,6 +140,9 @@ class BLECharacteristic
|
||||
bool notify(uint16_t num);
|
||||
bool notify(uint8_t num);
|
||||
|
||||
/*------------- Internal Functions -------------*/
|
||||
virtual void _eventHandler(ble_evt_t* event);
|
||||
|
||||
protected:
|
||||
bool _is_temp;
|
||||
uint16_t _max_len;
|
||||
@@ -166,9 +169,6 @@ class BLECharacteristic
|
||||
|
||||
/*------------- Internal Functions -------------*/
|
||||
void _init(void);
|
||||
virtual void _eventHandler(ble_evt_t* event);
|
||||
|
||||
friend class BLEGatt;
|
||||
};
|
||||
|
||||
#endif /* BLECHARACTERISTIC_H_ */
|
||||
Reference in new issue
Block a user