Closed Suphappy closed 1 year ago
The function "HandleDeviceNameWrite" was not called when I changed the accessory name in APP. The code is as follows.
static const HAPStringCharacteristic lightBulbNameCharacteristic = { .format = kHAPCharacteristicFormat_String, .iid = kIID_LightBulbName, .characteristicType = &kHAPCharacteristicType_Name, .debugDescription = kHAPCharacteristicDebugDescription_Name, .manufacturerDescription = NULL, .properties = { .readable = true, .writable = true, //.writable = false, // .supportsEventNotification = false, .supportsEventNotification = true, .hidden = false, .requiresTimedWrite = false, .supportsAuthorizationData = false, .ip = { .controlPoint = false, .supportsWriteResponse = false }, .ble = { .supportsBroadcastNotification = false, .supportsDisconnectedNotification = false, .readableWithoutSecurity = false, .writableWithoutSecurity = false } }, .constraints = { .maxLength = 64 }, // .callbacks = { .handleRead = HAPHandleNameRead, .handleWrite = NULL } .callbacks = { .handleRead = HandleDeviceNameRead, .handleWrite = HandleDeviceNameWrite } }; const HAPService lightBulbService = { .iid = kIID_LightBulb, .serviceType = &kHAPServiceType_LightBulb, .debugDescription = kHAPServiceDebugDescription_LightBulb, .name = "Light Bulb", .properties = { .primaryService = true, .hidden = false, .ble = { .supportsConfiguration = false } }, .linkedServices = NULL, .characteristics = (const HAPCharacteristic* const[]) { &lightBulbServiceSignatureCharacteristic, &lightBulbNameCharacteristic, &lightBulbOnCharacteristic, NULL } };
/**
If you mean the Name characteristic, it has no write permissions PermissionsPairedRead
Name
PermissionsPairedRead
Thank you
The function "HandleDeviceNameWrite" was not called when I changed the accessory name in APP. The code is as follows.
static const HAPStringCharacteristic lightBulbNameCharacteristic = { .format = kHAPCharacteristicFormat_String, .iid = kIID_LightBulbName, .characteristicType = &kHAPCharacteristicType_Name, .debugDescription = kHAPCharacteristicDebugDescription_Name, .manufacturerDescription = NULL, .properties = { .readable = true, .writable = true, //.writable = false, // .supportsEventNotification = false, .supportsEventNotification = true, .hidden = false, .requiresTimedWrite = false, .supportsAuthorizationData = false, .ip = { .controlPoint = false, .supportsWriteResponse = false }, .ble = { .supportsBroadcastNotification = false, .supportsDisconnectedNotification = false, .readableWithoutSecurity = false, .writableWithoutSecurity = false } }, .constraints = { .maxLength = 64 }, // .callbacks = { .handleRead = HAPHandleNameRead, .handleWrite = NULL } .callbacks = { .handleRead = HandleDeviceNameRead, .handleWrite = HandleDeviceNameWrite } }; const HAPService lightBulbService = { .iid = kIID_LightBulb, .serviceType = &kHAPServiceType_LightBulb, .debugDescription = kHAPServiceDebugDescription_LightBulb, .name = "Light Bulb", .properties = { .primaryService = true, .hidden = false, .ble = { .supportsConfiguration = false } }, .linkedServices = NULL, .characteristics = (const HAPCharacteristic* const[]) { &lightBulbServiceSignatureCharacteristic, &lightBulbNameCharacteristic, &lightBulbOnCharacteristic, NULL } };