Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added doorbell service #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}