Skip to content

Commit

Permalink
Make some accessors take const reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Aug 15, 2021
1 parent 371f626 commit 6372d53
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions HomeKitADK/HAP/HAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -4108,7 +4108,7 @@ HAP_ENUM_BEGIN(uint8_t, HAPAccessoryServerState) { /** Server is initialized but
* @return Accessory server state.
*/
HAP_RESULT_USE_CHECK
HAPAccessoryServerState HAPAccessoryServerGetState(HAPAccessoryServerRef* server);
HAPAccessoryServerState HAPAccessoryServerGetState(const HAPAccessoryServerRef* server);

/**
* Returns whether the HomeKit accessory server is paired with any controllers.
Expand All @@ -4118,7 +4118,7 @@ HAPAccessoryServerState HAPAccessoryServerGetState(HAPAccessoryServerRef* server
* @return Whether the accessory server is paired with any controllers.
*/
HAP_RESULT_USE_CHECK
bool HAPAccessoryServerIsPaired(HAPAccessoryServerRef* server);
bool HAPAccessoryServerIsPaired(const HAPAccessoryServerRef* server);

/**
* Starts the accessory server.
Expand Down
6 changes: 3 additions & 3 deletions HomeKitADK/HAP/HAPAccessoryServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ void HAPAccessoryServerRelease(HAPAccessoryServerRef* server_) {
}

HAP_RESULT_USE_CHECK
HAPAccessoryServerState HAPAccessoryServerGetState(HAPAccessoryServerRef* server_) {
HAPAccessoryServerState HAPAccessoryServerGetState(const HAPAccessoryServerRef* server_) {
HAPPrecondition(server_);
HAPAccessoryServer* server = (HAPAccessoryServer*) server_;
const HAPAccessoryServer* server = (const HAPAccessoryServer*) server_;

if (server->transports.ip) {
const HAPAccessoryServerServerEngine* _Nullable serverEngine =
Expand Down Expand Up @@ -820,7 +820,7 @@ static HAPError PairingExistsEnumerateCallback(
}

HAP_RESULT_USE_CHECK
bool HAPAccessoryServerIsPaired(HAPAccessoryServerRef* server_) {
bool HAPAccessoryServerIsPaired(const HAPAccessoryServerRef* server_) {
HAPPrecondition(server_);
const HAPAccessoryServer* server = (const HAPAccessoryServer*) server_;

Expand Down
4 changes: 2 additions & 2 deletions HomeKitADK/HAP/HAPIPAccessoryServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3861,9 +3861,9 @@ static HAPError engine_deinit(HAPAccessoryServerRef* server_) {
}

HAP_RESULT_USE_CHECK
static HAPAccessoryServerState engine_get_state(HAPAccessoryServerRef* server_) {
static HAPAccessoryServerState engine_get_state(const HAPAccessoryServerRef* server_) {
HAPPrecondition(server_);
HAPAccessoryServer* server = (HAPAccessoryServer*) server_;
const HAPAccessoryServer* server = (const HAPAccessoryServer*) server_;

switch (server->ip.state) {
case kHAPIPAccessoryServerState_Undefined: {
Expand Down
2 changes: 1 addition & 1 deletion HomeKitADK/HAP/HAPIPAccessoryServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef struct {
HAP_RESULT_USE_CHECK
HAPError (*deinit)(HAPAccessoryServerRef* p_srv);
HAP_RESULT_USE_CHECK
HAPAccessoryServerState (*get_state)(HAPAccessoryServerRef* p_srv);
HAPAccessoryServerState (*get_state)(const HAPAccessoryServerRef* p_srv);
void (*start)(HAPAccessoryServerRef* p_srv);
HAP_RESULT_USE_CHECK
HAPError (*stop)(HAPAccessoryServerRef* p_srv);
Expand Down

0 comments on commit 6372d53

Please sign in to comment.