Enabling Unicast on Thread: CoAP Client

Wave I am using Thread: CoAP Client and Thread: CoAP Server and having trouble enabling the Unicast mode on Client. When looking at the coap_client.c file, I see pressing button 1 or sending u from nRF Connect for Mobile send a request to coap_client_toggle_one_light() and that eventually goes to the following function:

static void toggle_one_light(struct k_work *item)
{
uint8_t payload = (uint8_t)THREAD_COAP_UTILS_LIGHT_CMD_TOGGLE;

ARG_UNUSED(item);

if (unique_local_addr.sin6_addr.s6_addr16[0] == 0) {
LOG_WRN("Peer address not set. Activate 'provisioning' option "on the server side");

return;
}

LOG_INF("Send 'light' request to: %s", unique_local_addr_str);

coap_send_request(COAP_METHOD_PUT, (const struct sockaddr *)&unique_local_addr, light_option, &payload, sizeof(payload), NULL);
}

However, the function never gets out from the if condition and shows "Peer address not set. Activate 'provisioning' option "on the server side". The local address looks like the following:

static struct sockaddr_in6 unique_local_addr = {
.sin6_family = AF_INET6,
.sin6_port = htons(COAP_PORT),
.sin6_addr.s6_addr = {0, },
.sin6_scope_id = 0U
};

I tried setting up the sin6_addr.s6_addr with 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 and used Button 4 both Client and Server sent a Provisioning request but no luck.

At this point, I am out of clues on how to make the Unicast work. Can anyone please give me a hand showing what am I missing?

Parents Reply Children
No Data
Related