apple / HomeKitADK

Apache License 2.0
2.55k stars 232 forks source link

Unable to trigger write name event in Home APP #131

Closed Suphappy closed 1 year ago

Suphappy commented 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 } };

Suphappy commented 1 year ago

/**

/**

d4rkmen commented 1 year ago

If you mean the Name characteristic, it has no write permissions PermissionsPairedRead

Suphappy commented 1 year ago

Thank you