added att error codes, flags for authentication, authorization, encryption

This commit is contained in:
matthias.ringwald@gmail.com 2014-01-06 11:32:04 +00:00
parent 434961bde4
commit 351e720709
2 changed files with 49 additions and 20 deletions

View File

@ -81,12 +81,23 @@ extern "C" {
#define ATT_SIGNED_WRITE_COMAND 0xD2 #define ATT_SIGNED_WRITE_COMAND 0xD2
// MARK: ATT Error Codes // MARK: ATT Error Codes
#define ATT_ERROR_ATTRIBUTE_INVALID 0x01 #define ATT_ERROR_ATTRIBUTE_INVALID 0x01
#define ATT_ERROR_READ_NOT_PERMITTED 0x02 #define ATT_ERROR_READ_NOT_PERMITTED 0x02
#define ATT_ERROR_WRITE_NOT_PERMITTED 0x03 #define ATT_ERROR_WRITE_NOT_PERMITTED 0x03
#define ATT_ERROR_INVALID_OFFSET 0x07 #define ATT_ERROR_INVALID_PDU 0x04
#define ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0a #define ATT_ERROR_INSUFFICIENT_AUTHENTICATION 0x05
#define ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10 #define ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06
#define ATT_ERROR_INVALID_OFFSET 0x07
#define ATT_ERROR_INSUFFICIENT_AUTHORIZATION 0x08
#define ATT_ERROR_PREPARE_QUEUE_FULL 0x09
#define ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0a
#define ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0b
#define ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0c
#define ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0d
#define ATT_ERROR_UNLIKELY_ERROR 0x0e
#define ATT_ERROR_INSUFFICIENT_ENCRYPTION 0x0f
#define ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10
#define ATT_ERROR_INSUFFICIENT_RESOURCES 0x11
// MARK: Attribute Property Flags // MARK: Attribute Property Flags
#define ATT_PROPERTY_BROADCAST 0x01 #define ATT_PROPERTY_BROADCAST 0x01
@ -103,6 +114,11 @@ extern "C" {
#define ATT_PROPERTY_DYNAMIC 0x100 #define ATT_PROPERTY_DYNAMIC 0x100
// 128 bit UUID used // 128 bit UUID used
#define ATT_PROPERTY_UUID128 0x200 #define ATT_PROPERTY_UUID128 0x200
// Authentication required
#define ATT_PROPERTY_AUTHENTICATION_REQUIRED 0x400
// Authorization from user required
#define ATT_PROPERTY_AUTHORIZATION_REQUIRED 0x800
// Encryption key size stored in upper 4 bits, 0 == no encryption, encryption key size - 1 otherwise
// MARK: GATT UUIDs // MARK: GATT UUIDs
#define GATT_PRIMARY_SERVICE_UUID 0x2800 #define GATT_PRIMARY_SERVICE_UUID 0x2800
@ -110,8 +126,8 @@ extern "C" {
#define GATT_INCLUDE_SERVICE_UUID 0x2802 #define GATT_INCLUDE_SERVICE_UUID 0x2802
#define GATT_CHARACTERISTICS_UUID 0x2803 #define GATT_CHARACTERISTICS_UUID 0x2803
#define GAP_SERVICE_UUID 0x1800 #define GAP_SERVICE_UUID 0x1800
#define GAP_DEVICE_NAME_UUID 0x2a00 #define GAP_DEVICE_NAME_UUID 0x2a00
#define ATT_TRANSACTION_MODE_NONE 0x0 #define ATT_TRANSACTION_MODE_NONE 0x0
#define ATT_TRANSACTION_MODE_ACTIVE 0x1 #define ATT_TRANSACTION_MODE_ACTIVE 0x1

View File

@ -41,18 +41,31 @@ assigned_uuids = {
} }
property_flags = { property_flags = {
'BROADCAST' : 0x01, 'BROADCAST' : 0x01,
'READ' : 0x02, 'READ' : 0x02,
'WRITE_WITHOUT_RESPONSE' : 0x04, 'WRITE_WITHOUT_RESPONSE' : 0x04,
'WRITE' : 0x08, 'WRITE' : 0x08,
'NOTIFY': 0x10, 'NOTIFY': 0x10,
'INDICATE' : 0x20, 'INDICATE' : 0x20,
'AUTHENTICATED_SIGNED_WRITE' : 0x40, 'AUTHENTICATED_SIGNED_WRITE' : 0x40,
'EXTENDED_PROPERTIES' : 0x80, 'EXTENDED_PROPERTIES' : 0x80,
# custom BTstack extension # custom BTstack extension
'DYNAMIC': 0x100, 'DYNAMIC': 0x100,
'LONG_UUID': 0x200, 'LONG_UUID': 0x200,
'CLIENT_CONFIGURATION': 0x400, 'AUTHENTICATION_REQUIRED': 0x400,
'AUTHORIZATION_REQUIRED': 0x800,
'ENCRYPTION_KEY_SIZE_7': 0x6000,
'ENCRYPTION_KEY_SIZE_8': 0x7000,
'ENCRYPTION_KEY_SIZE_9': 0x8000,
'ENCRYPTION_KEY_SIZE_10': 0x9000,
'ENCRYPTION_KEY_SIZE_11': 0xa000,
'ENCRYPTION_KEY_SIZE_12': 0xb000,
'ENCRYPTION_KEY_SIZE_13': 0xc000,
'ENCRYPTION_KEY_SIZE_14': 0xd000,
'ENCRYPTION_KEY_SIZE_15': 0xe000,
'ENCRYPTION_KEY_SIZE_16': 0xf000,
# only used by gatt compiler
'CLIENT_CONFIGURATION': 0x10000,
} }
services = dict() services = dict()
@ -107,7 +120,7 @@ def write_8(fout, value):
fout.write( "0x%02x, " % (value & 0xff)) fout.write( "0x%02x, " % (value & 0xff))
def write_16(fout, value): def write_16(fout, value):
fout.write('0x%02x, 0x%02x, ' % (value & 0xff, value >> 8)) fout.write('0x%02x, 0x%02x, ' % (value & 0xff, (value >> 8) & 0xff))
def write_uuid(uuid): def write_uuid(uuid):
for byte in uuid: for byte in uuid: