Skip to content

Commit 1f4a813

Browse files
author
Scott Powell
committed
* companion: new command: CMD_GET_CONTACT_BY_KEY (30)
1 parent abb8b54 commit 1f4a813

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/companion_radio/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ static uint32_t _atoi(const char* sp) {
156156
#define CMD_SEND_STATUS_REQ 27
157157
#define CMD_HAS_CONNECTION 28
158158
#define CMD_LOGOUT 29 // 'Disconnect'
159+
#define CMD_GET_CONTACT_BY_KEY 30
159160

160161
#define RESP_CODE_OK 0
161162
#define RESP_CODE_ERR 1
@@ -955,6 +956,14 @@ class MyMesh : public BaseChatMesh {
955956
} else {
956957
writeErrFrame(); // not found, or unable to send
957958
}
959+
} else if (cmd_frame[0] == CMD_GET_CONTACT_BY_KEY) {
960+
uint8_t* pub_key = &cmd_frame[1];
961+
ContactInfo* contact = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
962+
if (contact) {
963+
writeContactRespFrame(RESP_CODE_CONTACT, *contact);
964+
} else {
965+
writeErrFrame(); // not found
966+
}
958967
} else if (cmd_frame[0] == CMD_EXPORT_CONTACT) {
959968
if (len < 1 + PUB_KEY_SIZE) {
960969
// export SELF

0 commit comments

Comments
 (0)