Open andy9a9 opened 1 year ago
Next question is, why did you chose the OpenThread variant, while the posix Linux is using a native sockets? For example in oc_connectivity_init
// Linux
int
oc_connectivity_init(size_t device)
{
OC_DBG("Initializing connectivity for device %zd", device);
ip_context_t *dev = (ip_context_t *)oc_memb_alloc(&ip_context_s);
if (!dev) {
oc_abort("Insufficient memory");
}
oc_list_add(ip_contexts, dev);
dev->device = device;
OC_LIST_STRUCT_INIT(dev, eps);
if (pthread_mutex_init(&dev->rfds_mutex, NULL) != 0) {
oc_abort("error initializing TCP adapter mutex");
}
if (pipe(dev->shutdown_pipe) < 0) {
OC_ERR("shutdown pipe: %d", errno);
return -1;
}
if (set_nonblock_socket(dev->shutdown_pipe[0]) < 0) {
OC_ERR("Could not set non-block shutdown_pipe[0]");
return -1;
}
memset(&dev->mcast, 0, sizeof(struct sockaddr_storage));
memset(&dev->server, 0, sizeof(struct sockaddr_storage));
// ...
if (setsockopt(
// zephyr
int oc_connectivity_init(size_t device)
{
otError error;
struct otInstance *instance = openthread_get_default_instance();
otSockAddr sockaddr;
memset(&socket, 0, sizeof(otUdpSocket));
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.mPort = 5683; // CoAP port
if (!otUdpIsOpen(instance, &socket))
{
error = otUdpOpen(instance, &socket, handle_udp_received, NULL);
error = otUdpBind(instance, &socket, &sockaddr, OT_NETIF_THREAD);
}
}
Can't this port be working with Coap instead of OpenThread?
Dear maintainers!
I tried to build the
samples/light_switch_sensor
with zephyr project and it failed.Is there something special what should I set, like
CONFIG_OPENTHREAD_MLR=n
? Is there some special version needed? See err.log for more details.Thanks, Andy