Skip to content

Commit

Permalink
Add Accessory::SetName
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Feb 20, 2021
1 parent 2ea8fbd commit 0aa1037
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/mgos_hap_accessory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace hap {
HAPAccessoryServerRef* server() const;
void set_server(HAPAccessoryServerRef* server);

void SetName(const std::string &name);
void SetCategory(HAPAccessoryCategory category);

void AddService(Service* svc);
Expand All @@ -52,7 +53,7 @@ namespace hap {
static HAPError
Identify(HAPAccessoryServerRef* server, const HAPAccessoryIdentifyRequest* request, void* context);

const std::string name_;
std::string name_;
const IdentifyCB identify_cb_;
HAPAccessoryServerRef* server_;

Expand Down
5 changes: 5 additions & 0 deletions src/mgos_hap_accessory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ namespace hap {
server_ = server;
}

void Accessory::SetName(const std::string &name) {
name_ = name;
hai_.acc.name = name_.c_str();
}

void Accessory::SetCategory(HAPAccessoryCategory category) {
hai_.acc.category = category;
}
Expand Down

0 comments on commit 0aa1037

Please sign in to comment.