void main(void) #endif { int err; err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); return; } printk("Bluetooth initialized\n"); net_init(); ipss_init(); err = ipss_advertise(); if (err) { printk("Advertising failed to start (err %d)\n", err); return; } printk("Advertising successfully started\n"); ipss_listen(); }
void main(void) { net_init(); init_app(); ipsum_len = strlen(lorem_ipsum); #if defined(CONFIG_NETWORKING_WITH_BT) if (bt_enable(NULL)) { PRINT("Bluetooth init failed\n"); return; } ipss_init(); ipss_advertise(); #endif if (!get_context(&unicast, &multicast)) { PRINT("%s: Cannot get network context\n", __func__); return; } #if defined(CONFIG_MICROKERNEL) receiving(); #else task_fiber_start(&stack_receiving[0], STACKSIZE, (nano_fiber_entry_t)receiving, 0, 0, 7, 0); #endif }
void main(void) { int err; init_app(); err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); return; } printk("Bluetooth initialized\n"); ipss_init(); err = ipss_advertise(); if (err) { printk("Advertising failed to start (err %d)\n", err); return; } printk("Advertising successfully started\n"); k_thread_create(&thread_data, thread_stack, STACKSIZE, (k_thread_entry_t)listen, NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0); }
void main(void) { init_app(); #if defined(CONFIG_NET_L2_BLUETOOTH) if (bt_enable(NULL)) { NET_ERR("Bluetooth init failed"); return; } ipss_init(); ipss_advertise(); #endif #if defined(CONFIG_NET_L2_IEEE802154) if (ieee802154_sample_setup()) { NET_ERR("IEEE 802.15.4 setup failed"); return; } #endif k_thread_create(&thread_data, thread_stack, STACKSIZE, (k_thread_entry_t)receive, NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0); }
void main(void) { int ret; char ep_name[ENDPOINT_LEN]; SYS_LOG_INF(APP_BANNER); k_sem_init(&quit_lock, 0, UINT_MAX); #if defined(CONFIG_NET_L2_BT) if (bt_enable(NULL)) { SYS_LOG_ERR("Bluetooth init failed"); return; } ipss_init(); ipss_advertise(); #endif ret = lwm2m_setup(); if (ret < 0) { SYS_LOG_ERR("Cannot setup LWM2M fields (%d)", ret); return; } #if defined(CONFIG_NET_IPV6) ret = setup_net_app_ctx(&udp6, CONFIG_NET_APP_PEER_IPV6_ADDR); if (ret < 0) { goto cleanup_ipv6; } ret = set_endpoint_name(ep_name, udp6.ipv6.local.family); if (ret < 0) { SYS_LOG_ERR("Cannot set IPv6 endpoint name (%d)", ret); goto cleanup_ipv6; } ret = lwm2m_engine_start(udp6.ipv6.ctx); if (ret < 0) { SYS_LOG_ERR("Cannot init LWM2M IPv6 engine (%d)", ret); goto cleanup_ipv6; } ret = lwm2m_rd_client_start(udp6.ipv6.ctx, &udp6.ipv6.remote, ep_name); if (ret < 0) { SYS_LOG_ERR("LWM2M init LWM2M IPv6 RD client error (%d)", ret); goto cleanup_ipv6; } SYS_LOG_INF("IPv6 setup complete."); #endif #if defined(CONFIG_NET_IPV4) ret = setup_net_app_ctx(&udp4, CONFIG_NET_APP_PEER_IPV4_ADDR); if (ret < 0) { goto cleanup_ipv4; } ret = set_endpoint_name(ep_name, udp4.ipv4.local.family); if (ret < 0) { SYS_LOG_ERR("Cannot set IPv4 endpoint name (%d)", ret); goto cleanup_ipv4; } ret = lwm2m_engine_start(udp4.ipv4.ctx); if (ret < 0) { SYS_LOG_ERR("Cannot init LWM2M IPv4 engine (%d)", ret); goto cleanup_ipv4; } ret = lwm2m_rd_client_start(udp4.ipv4.ctx, &udp4.ipv4.remote, ep_name); if (ret < 0) { SYS_LOG_ERR("LWM2M init LWM2M IPv4 RD client error (%d)", ret); goto cleanup_ipv4; } SYS_LOG_INF("IPv4 setup complete."); #endif k_sem_take(&quit_lock, K_FOREVER); #if defined(CONFIG_NET_IPV4) cleanup_ipv4: net_app_close(&udp4); net_app_release(&udp4); #endif #if defined(CONFIG_NET_IPV6) cleanup_ipv6: net_app_close(&udp6); net_app_release(&udp6); #endif }