Skip to content

Commit

Permalink
Added doorbell service.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehoersten committed Jun 2, 2021
1 parent 389189a commit a5c47ad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ extern "C" {
#define HAP_SERV_UUID_IRRIGATION_SYSTEM "CF"
#define HAP_SERV_UUID_VALVE "D0"
#define HAP_SERV_UUID_FAUCET "D7"
#define HAP_SERV_UUID_DOORBELL "121"

/** Create Accessory Information Service
*
Expand Down Expand Up @@ -553,6 +554,18 @@ hap_serv_t *hap_serv_valve_create(uint8_t active, uint8_t in_use, uint8_t valve_
*/
hap_serv_t *hap_serv_faucet_create(uint8_t active);

/** Create Doorbell Service
*
* This API will create the Doorbell Service with the mandatory
* characteristics as per the HAP Specs.
*
* @param[in] programmable_switch_event Initial value of Programmable Switch Event characteristic
*
* @return Pointer to the service object on success
* @return NULL on failure
*/
hap_serv_t *hap_serv_doorbell_create(uint8_t programmable_switch_event);

#ifdef __cplusplus
}
#endif
Expand Down
14 changes: 14 additions & 0 deletions components/homekit/esp_hap_apple_profiles/src/hap_apple_servs.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,17 @@ hap_serv_t *hap_serv_faucet_create(uint8_t active)
return NULL;
}

hap_serv_t *hap_serv_doorbell_create(uint8_t programmable_switch_event)
{
hap_serv_t *hs = hap_serv_create(HAP_SERV_UUID_DOORBELL);
if (!hs) {
return NULL;
}
if (hap_serv_add_char(hs, hap_char_programmable_switch_event_create(programmable_switch_event)) != HAP_SUCCESS) {
goto err;
}
return hs;
err:
hap_serv_delete(hs);
return NULL;
}

0 comments on commit a5c47ad

Please sign in to comment.