/* user main function, called by AppFramework after system init done && wifi
 * station on in user_main thread.
 */
OSStatus user_main( app_context_t * const app_context )
{
    OSStatus err = kNoErr;
    int time_sencond = 50*1000;  /* 60s */


    require(app_context, exit);
    net_init(app_context);

    /* Create a new thread */

    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "RGB_LED", LED_handleThread, 1024, NULL );
    require_noerr_string( err, exit, "ERROR: Unable to start the RGB LED thread ." );

    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "MP3_PLAY", MP3_handleThread, 1024, NULL );
    require_noerr_string( err, exit, "ERROR: Unable to start the MP3 PLAY thread" );

    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "BAT_DETECT", BAT_handleThread, 500, NULL );
    require_noerr_string( err, exit, "ERROR: Unable to start the BAT DETECT thread ." );

    KEY_Init(KEY_irq_handler); //按键初始化

    mico_rtos_init_semaphore(&cupTimeObj.playMp3_sem, 1);  //信号量初始化
    mico_rtos_init_semaphore(&cupTimeObj.playLed_sem, 1);
    mico_rtos_init_semaphore(&cupTimeObj.stopLed_sem, 1);

    err = mico_init_timer(&cupTimeObj.cup_timer, time_sencond, cup_timer_timeout_handler, (void *)&cupTimeObj);
    cupTimeObj.drinkTime = 1;
    cupTimeObj.playMode = PLAY_MP3_LED;
    if (KEY_getValue() == KEY_DOWN)
    {
        TIMER_start(); //启动定时喝水
    }

    while(1)
    {
        // printf("this is main thread.\r\n");
        //net_test(app_context);
        mico_thread_sleep(10);
    }

exit:
    if(kNoErr != err) {
        printf("ERROR: user_main thread exit with err=%d", err);
    }
    mico_rtos_delete_thread(NULL);
    return kNoErr;
}
Example #2
0
int main (void)
{
	printf ("Libnet RDM chat client version %d.%d\n", VER_MAJOR, VER_MINOR);
	printf ("built at " __TIME__ " on " __DATE__ "\n");
	printf ("\n");

	net_init();
	net_loadconfig (NULL);

	get_driver();
	init();

	do_client();

	return 0;
}
Example #3
0
hFILE *hopen_net(const char *filename, const char *mode)
{
    hFILE_net *fp;

    // Do any networking initialisation if this is the first use.
    if (! net_inited) { if (net_init() < 0) return NULL; }

    fp = (hFILE_net *) hfile_init(sizeof (hFILE_net), mode, 0);
    if (fp == NULL) return NULL;

    fp->netfp = knet_open(filename, mode);
    if (fp->netfp == NULL) { hfile_destroy((hFILE *) fp); return NULL; }

    fp->base.backend = &net_backend;
    return &fp->base;
}
Example #4
0
void m_init(void) {
	done = 0;

	// Initialize ncurses lib (libncurses5-dev)
	initscr();
	noecho();
	keypad(stdscr, TRUE);
	cbreak();

	if (auto_mode == 1) {
		usleep(2000000);
		net_init();
		net_connect(game_server_ip, game_server_port);
		nodelay(stdscr, TRUE); // Do not wait for kb_input
	}
}
Example #5
0
int main()
{
    printf("testing network, hit 'x' to terminate...\n");

    net_init(NULL, 0, 0, 0, IP_DHCP);

    struct tcp_pcb *server;
    server = tcp_new();
    tcp_bind(server, IP_ADDR_ANY, 9000);
    server = tcp_listen(server);
    tcp_accept(server, server_newclient);

    while (1)
        if (getchar()=='x') break;
    exit(0);
}
Example #6
0
int tun_name2idx(struct tun_t *tun, char *name) {
  int i;

  for (i=0; i<TUN_MAX_INTERFACES; i++)
    if (!strcmp(name, tun->_interfaces[i].devname))
      return tun->_interfaces[i].idx;

  /* Not found? Check for discovery */
  {
    struct rtmon_iface *rti = rtmon_find(&_rtmon, name);
    if (rti) {
      net_interface *newif = 0;
      net_interface netif;
      if (_options.debug)
        syslog(LOG_DEBUG, "Discoving TUN %s", name);
      memset(&netif, 0, sizeof(netif));
      strlcpy(netif.devname, rti->devname, sizeof(netif.devname));
      memcpy(netif.hwaddr, rti->hwaddr, sizeof(netif.hwaddr));
      netif.address = rti->address;
      netif.netmask = rti->netmask;
      netif.gateway = rti->gateway;
      netif.broadcast = rti->broadcast;
      netif.devflags = rti->devflags;
      netif.mtu = rti->mtu;
      netif.ifindex = rti->index;

      newif = tun_newif(tun, &netif);
      if (newif) {

	if (net_init(newif, 0, ETH_P_ALL, 1, 0) < 0) {
	  syslog(LOG_ERR, "%s: net_init", strerror(errno));
	}
	else {
	  net_select_reg(tun->sctx,
			 newif->fd,
			 SELECT_READ, (select_callback) tun_decaps,
			 tun, newif->idx);
	}

	return newif->idx;
      }
    }
  }

  return 0; /* tun/tap index */
}
Example #7
0
static DWORD test_do(HWND hwnd)
{
    int s = net_init();

    fd_set rfds;
    struct timeval tv;
    struct sockaddr_in to;
    struct sockaddr_in from;
    int start = time(NULL);
    int ret = 0;

    net_address(&to, config_get("Host"), config_get_int("Port"));
    net_bind("0.0.0.0", 8054);

    net_write_int8(CMD_TESTP2P);
    net_write_int32(start);

    while (time(NULL) < start + 5)
    {
        net_send_noflush(&to);

        FD_ZERO(&rfds);
        FD_SET(s, &rfds);
        tv.tv_sec = 1;
        tv.tv_usec = 0;

        if (select(s + 1, &rfds, NULL, NULL, &tv) > -1)
        {
            if (FD_ISSET(s, &rfds))
            {
                net_recv(&from);

                if (net_read_int8() == CMD_TESTP2P && net_read_int32() == start)
                {
                    ret = 1;
                    break;
                }
            }
        }
    }

    net_free();

    PostMessage(hwnd, WM_USER + 2, ret, 0);
    return 0;
}
Example #8
0
/**
 * initialize - Performs all initialization procedures
 *
 * Returns a CHARLIE_STAT_* constant that indicates the succes or
 * failure of the initialization.
 */
static uint8_t initialize(void)
{
    charlie.shutdown = FALSE;
    
    init_atmega();
    init_ports();
    debug_init_ports();
    
    rs232_init();
    spi_init_master();
    i2c_init();
    
    if (rtc_init()) {
        return CHARLIE_STAT_RTC_ERROR;
    }
    time_init();
    time_sync_to_realtime();
    
    sched_init();
    
    if (card_init()) {
        return CHARLIE_STAT_CARD_ERROR;
    }
    if (fsys_init()) {
        return CHARLIE_STAT_FSYS_ERROR;
    }
    if (fsys_check_read_only()) {
        return CHARLIE_STAT_FSYS_READONLY;
    }
    
    cfg_load();
    if (enc28j60_init(&cfg.mac_addr)) {
        return CHARLIE_STAT_NET_ERROR;
    }
    net_init();
    
    adc_init();
    sensors_init();
    pump_init();
    plants_init();
    
    sei();

    return CHARLIE_STAT_OK;
}
Example #9
0
int init_client(int argc, char *argv[]){

 net_init ();
 /*net_loadconfig (NULL);*/
 net_detectdrivers (net_drivers_all); 
 net_initdrivers (net_drivers_all);

 /* Set up Proc Mask + SININT hook */
  init_SIGCHLD_hook();

 /* Parse the input */
 if ( b_parser(argc,argv) == ERROR ){
  printf("# Bad parameters! \n");
  return ERROR;
 }/*if*/
 
  return OK;
}
Example #10
0
static void lwip_task(void * p) {
    net_init();
    httpd_init();

    uint32_t currentIP = board_netif.ip_addr.addr;
    while (1) {
        xSemaphoreTake(lwip_sem, 10 / portTICK_RATE_MS);
        interface_check_input(&board_netif);
        sys_check_timeouts();
        if (board_netif.ip_addr.addr != currentIP) {
            currentIP = board_netif.ip_addr.addr;
            printf("got an IP address: %i.%i.%i.%i\n",
                (board_netif.ip_addr.addr >>  0) & 0xff,
                (board_netif.ip_addr.addr >>  8) & 0xff,
                (board_netif.ip_addr.addr >> 16) & 0xff,
                (board_netif.ip_addr.addr >> 24) & 0xff);
        }
    }
Example #11
0
static int all_the_internets(void)
{
int port;
int pos, len, rc, cnt;

  for(pos=cnt=0;conffile.server_ports[pos];pos += len	) {
    rc = sscanf(conffile.server_ports+pos, "%d%n", &port, &len );
    if (rc < 0) break;
    if (rc < 1) { len=1; continue; }
    if (net_init(port, conffile.want_udp_port > 0 ? 1 : 0)) {
      Logit("Init failed on port %d.", port);
      continue;
      }
    Logit("Initialized on port %d.", port);
    cnt++;
  }
return cnt;
}
Example #12
0
int
main(int argc, char **argv)
{
	int rv;

	UploadLogInit();
	parse_args(argc, argv);

	net_init();

	log("%s: listening on port %d for image data from %s (max of %llu bytes)",
	    path, portnum, inet_ntoa(clientip), maxsize);

	rv = recv_file();
	close(sock);

	exit(rv);
}
Example #13
0
void taskA(void)
{
	struct net_context *ctx;

	net_init();
	init_test();

	ctx = get_context(&any_addr, SRC_PORT, &loopback_addr, DEST_PORT);
	if (!ctx) {
		PRINT("%s: Cannot get network context\n", __func__);
		return;
	}

	/* taskA gives its own semaphore, allowing it to say hello right away */
	task_sem_give(TASKASEM);

	listen(__func__, TASKASEM, TASKBSEM, ctx);
}
Example #14
0
int main(void) {
    halInit();
    chSysInit();

    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO - 1, Thread1, NULL);

    uint8_t my_addr, other_addr;
    if (true) {
        my_addr = 0x42;
        other_addr = 0x43;
    } else {
        my_addr = 0x43;
        other_addr = 0x42;
    }


    palSetPadMode(GPIOD, 5, PAL_MODE_ALTERNATE(7));
    palSetPadMode(GPIOD, 6, PAL_MODE_ALTERNATE(7) + PAL_STM32_PUPDR_PULLUP);
    sdStart(&SD2, NULL); // PD5 TX, PD6 RX
    sdStart(&SD3, NULL); // connected to stlink

    sduObjectInit(&SDU1);
    sduStart(&SDU1, &serusbcfg);
    usbDisconnectBus(serusbcfg.usbp);
    chThdSleepMilliseconds(100);
    usbStart(serusbcfg.usbp, &usbcfg);
    usbConnectBus(serusbcfg.usbp);
    chThdSleepMilliseconds(100);

    net_init(my_addr);
    // interface 0, USB
    chThdCreateStatic(net_rx0_thd_wa, sizeof(net_rx0_thd_wa),
                      NORMALPRIO - 1, net_rx0_thd, &SDU1);
    // interface 1 UART connection to other node
    chThdCreateStatic(net_rx1_thd_wa, sizeof(net_rx1_thd_wa),
                      NORMALPRIO - 1, net_rx1_thd, &SD2);
    net_route_add(&net_node, other_addr, 0xff, 1, 0);

    int i = 0;
    while (true) {
        chprintf((BaseSequentialStream *)&SD3, "node %x, counting %d\n", my_addr, i++);
        chThdSleepMilliseconds(500);
    }
}
Example #15
0
void NetworkInit() {
    if (networkInitialized) return;
    int retryCount = 0;
    
    int ret = 0;
    printf("\nInitializing Network...");
    fflush(stdout);
    
    ret = if_config(hostip, NULL, NULL, true);
    if (ret < 0) {
        printf(
            "\n>> ERROR! Failed to Initialize the network: ErrorCode (%d)\n",
            ret);
        return;
    }

    //SpinnerStart();
    while (1) {
        ret = net_init();
        if (ret < 0) {
            if (ret != -EAGAIN) {
                retryCount++;
                printf("net_init failed trying again: %d\n", ret);
                sleep(3);
            }
        }
        if (retryCount > 4) break;
        if (!ret) break;
        sleep(1);
        printf(".");
        fflush(stdout);
    }
   // SpinnerStop();
    
    if (ret < 0 || retryCount != 0) {
        printf(
            "\n>> ERROR! Failed to Initialize the network: ErrorCode (%d)\n",
            ret);
        return;
    }

    printf("\b.Done\n");
    networkInitialized = true;
}
void
NetworkConsole::Init()
{
	printf("Initializing Network\n");
	
	int Connect = net_init();
	if(Connect != 0)
	{
		printf("Net_Init() failed.\n");
	}
	else
	{
		printf("Net_Init() successful.\n\n");
		
		printf("Net_Socket Initializing.\n");
		Data->netSocket = net_socket(AF_INET, SOCK_DGRAM, 0);
		
		if(Data->netSocket == INVALID_SOCKET)
		{
			printf("Net_Socket Initialization failed.\n");
		}
		else
		{
			printf("Net_Socket Initialized.\n\n");
			printf("Establishing server on port %d.\n",MULTICAST_PORT);
			
			Data->sin.sin_port=htons(MULTICAST_PORT);
			Data->sin.sin_addr.s_addr=inet_addr(MULTICAST_GROUP);//replace with multicast destination
			Data->sin.sin_family=AF_INET;
			if(net_bind(Data->netSocket,(sockaddr*)&(Data->sin), sizeof(Data->sin)) == SOCKET_ERROR)
			{
				printf("Failed to bind.\n");
			}
			else
			{
				printf("Server established!\n");
				if(net_connect(Data->netSocket,(sockaddr*)&(Data->sin), sizeof(Data->sin))==-1)
				{
					printf("net_connect Error\n");
				}
			}
		}
	}
}
Example #17
0
static int nc_stdio_start(struct stdio_dev *dev)
{
	int retval;

	nc_out_port = 6666; /* default port */
	nc_in_port = nc_out_port;

	retval = refresh_settings_from_env();
	if (retval != 0)
		return retval;

	/*
	 * Initialize the static IP settings and buffer pointers
	 * incase we call net_send_udp_packet before net_loop
	 */
	net_init();

	return 0;
}
Example #18
0
void start(void) {
	mos_node_id_set(1);
	
	is_base = false;
	
	// Initialize net layer
	net_init();
		   
	// Start the CTP backends 
	ctp_proto_init();
	
	// Wait a while till the routing is possibly established      
	mos_mdelay(10);
	
	net_ioctl(CTP_PROTO_ID, CTP_SET_TESTBED);
	printf("Running net layer and CTP backend... \n");
	
	// transportInit(true);
}
Example #19
0
int void_init( unsigned char flags )
{
	int status = 0;
	if ( flags&VOID_LOGGER )
		status |= log_init()<<6;
	if ( flags&VOID_VIDEO )
		status |= video_init();
	if ( flags&VOID_AUDIO )
		status |= audio_init()<<1;
	if ( flags&VOID_INPUT )
		status |= input_init()<<2;
	if ( flags&VOID_NET )
		status |= net_init()<<3;
	if ( flags&VOID_SCRIPT )
		status |= script_init()<<4;
	if ( flags&VOID_PHYSICS )
		status |= phys_init()<<5;
	return status;
}
Example #20
0
void m_thread() {
    dvdrp_filter_list *pred;
    int8_t ret;
    dvdrp_constraint_list *clist_ptr;
    printf("Hello from DV/DRP test recv!\n");

    net_init();
    dvdrp_init();

    //turn down the power to make it easy to test multihop
    com_ioctl(IFACE_RADIO, CC1000_TX_POWER, 1);

    
    ret = net_proto_set(DVDRP_PROTO_ID);
    if(ret == NET_PROTO_INVALID) {
	printf("Invalid proto\n");
    }

    net_event_register(1, recv);

    pred = pool_malloc(&filter_pool);
    pred->next = NULL;

    clist_ptr = pool_malloc(&constraint_pool);
    clist_ptr->name = TEMP_VALUE;
    clist_ptr->value = 0;
    clist_ptr->compare_type = DVDRP_COMPARE_GT;
    pred->constraints = clist_ptr;

    clist_ptr = pool_malloc(&constraint_pool);
    clist_ptr->name = LIGHT_VALUE;
    clist_ptr->value = 150;
    clist_ptr->compare_type = DVDRP_COMPARE_GT;
    clist_ptr->next = NULL;

    pred->constraints->next = clist_ptr;

    net_ioctl(DVDRP_PROTO_ID, DVDRP_IOCTL_SETPRED, pred, 0);

    mos_led_toggle(2);
    
    printf("Waiting for mesgs.\n\n");
}
Example #21
0
int main (void) 
{
	NET_DRIVERNAME *drivers;
	int i, j, class;
  	char buf[1024];

	net_init();
  
	puts ("Defined network classes:");

	for (j = 0; j < NET_CLASS_MAX; j++)
		if (net_classes[j].name)
			printf ("%d\t%s\n", j, net_classes[j].name);

	puts ("Choose one:");
	fgets (buf, sizeof buf, stdin);
	j = atoi (buf);
	printf ("\n\n%d: ", j);
	if (!net_classes[j].name) {
		puts ("no such class");
		return 1;
	}

	puts (net_classes[j].name);

	printf ("Address format information: ");
	if (!net_classes[j].addrhelp)
		puts ("None");
	else
		puts (net_classes[j].addrhelp);

	puts ("Drivers in this class:");

	drivers = net_getdrivernames (net_classes[j].drivers);

	for (i = 0; drivers[i].name; i++)
		printf ("%d\t%s\n", drivers[i].num, drivers[i].name);

	free (drivers);
	net_shutdown();

	return 0;
}
Example #22
0
int main(void) {
  SystemInit();

  debug_puts("Happy Face!\n");

  SystemCoreClockUpdate();
  uint32_t clock = SystemCoreClock;

  INIT_LEDS();

  /* Setup the memory */
  memory_init();

  /* Start applications */
  net_init();
  radio_init();
  init_current_time();

  /* Switch to a stable clock source from the radio */
  switch_to_stable_clock();

  /* Setup the Repetitive Interrupt Timer (RIT) */
  LPC_SC->PCONP |= (1 << 16); /* Power up the RIT, PCLK=CCLK/4 */
  LPC_RIT->RICTRL = 1; /* Disable RIT, Clear interrupt */
  NVIC_SetPriority(RIT_IRQn, 31); /* Set Lowest Priority */
  NVIC_EnableIRQ(RIT_IRQn); /* Enable the interrupt */
  LPC_RIT->RIMASK = 0; /* Compare all the bits */
  LPC_RIT->RICOMPVAL = 500*25; /* 500µS on 25MHz PCLK */
  /* Enable RIT, Halt on Debug, Clear on match */
  LPC_RIT->RICTRL = (1<<3)|(0<<2)|(1<<1);

  /* Setup sleep mode */
  LPC_SC->PCON &= ~0x3; /* Sleep or Deep Sleep mode */
  SCB->SCR &= ~(1<<2); /* Sleep mode */

  /* Sleep forever */
  while(1) {
    __WFI();
  }

  return 0;
}
Example #23
0
static int check_net_config(void)
{
	if (env_changed(&env_id)) {
		char *p;
		char *bip;

		bootme_dst_port = EDBG_DOWNLOAD_PORT;
		if (bootme_ip == 0) {
			bip = getenv("bootmeip");
			if (bip) {
				bootme_ip = getenv_IPaddr("bootmeip");
				if (!bootme_ip)
					return -EINVAL;
				p = strchr(bip, ':');
				if (p) {
					bootme_dst_port = simple_strtoul(p + 1, NULL, 10);
				}
			} else {
				memset(&bootme_ip, 0xff, sizeof(bootme_ip));
			}
		}

		p = getenv("bootme_dst_port");
		if (p)
			bootme_dst_port = simple_strtoul(p, NULL, 10);

		p = getenv("bootme_src_port");
		if (p)
			bootme_src_port = simple_strtoul(p, NULL, 10);
		else
			bootme_src_port = bootme_dst_port;

		if (is_broadcast(bootme_ip))
			memset(bootme_ether, 0xff, sizeof(bootme_ether));
		else
			memset(bootme_ether, 0, sizeof(bootme_ether));

		net_init();
		NetServerIP = bootme_ip;
	}
	return 0;
}
/* The start function is automatically called by the operating system,
   for single-threaded applications, treat start() like main(). for multi-
   threaded applications, start each thread in the start() function.*/
void start(void)
{
  /* must start the net thread */
   net_init();

   mos_thread_new(mos_command_daemon, MOS_COMMANDER_STACK_SIZE,
		  PRIORITY_NORMAL);

  /* Initialize the MST backend */
   mst_proto_init();

   uint8_t myaddr = mos_node_id_get();
   
   net_ioctl(MST_PROTO_ID, SET_ADDR, (uint8_t)myaddr);
   net_ioctl(MST_PROTO_ID, SET_DTB, 20);

   //This is the basic app thread
   mos_thread_new(recv, 128, PRIORITY_NORMAL);
   mos_thread_new(send, 128, PRIORITY_NORMAL);
}
Example #25
0
void main(void)
{
	net_init();

	init_server();

	ipsum_len = strlen(lorem_ipsum);

	if (!get_context(&unicast, &multicast)) {
		PRINT("%s: Cannot get network context\n", __func__);
		return;
	}

#ifdef CONFIG_MICROKERNEL
	receiving();
#else
	task_fiber_start(&stack_receiving[0], STACKSIZE,
			(nano_fiber_entry_t)receiving, 0, 0, 7, 0);
#endif
}
SOL_API int
sol_network_init(void)
{
    struct sol_network_link *iface;
    struct sol_network_link_addr *addr;

    net_init();

    iface = sol_vector_append(&links);
    SOL_NULL_CHECK(iface, -ENOMEM);

    sol_vector_init(&iface->addrs, sizeof(struct sol_network_link_addr));

    addr = sol_vector_append(&iface->addrs);
    SOL_NULL_CHECK_GOTO(addr, addr_append_error);

    if (!get_local_address(addr))
        goto get_address_error;

    SOL_SET_API_VERSION(iface->api_version = SOL_NETWORK_LINK_API_VERSION; )
Example #27
0
int main(int argc, char **argv) {
	uint8 ip[4];
	struct sockaddr_in dnssrv;

	// KOS code
	net_init();
	lwip_kos_init();

	// Do the query
	dnssrv.sin_family = AF_INET;
	dnssrv.sin_port = htons(53);
	dnssrv.sin_addr.s_addr = htonl(0x0a030202);
	if (lwip_gethostbyname(&dnssrv, "www.allusion.net", ip) < 0)
		perror("Can't look up name");
	else {
		printf("www.allusion.net is %d.%d.%d.%d\n",
			ip[0], ip[1], ip[2], ip[3]);
	}
	return 0;
}
Example #28
0
int supervisor_init () {
	net_init ();
	packets = 0;
	while (1) {
		printf ("[");
		int i = 0;
		for (i = 0; i < packets * 20 / options.max_packets; i ++) {
			printf ("#");
		}
		for ( ; i < 20; i ++) {
			printf (" ");
		}
		packet_size = 200;
		printf ("] %llu packets / second (%f Mbit/s)\n", packets, ((double) packet_size * packets * 8) / 1048576.0);
		fflush (stdout);
		packets = 0;
		sleep (1);
	}
	return -1;
}
Example #29
0
void start(void) {
	mos_node_id_set(4);
	
	is_base = false;
	
	// Initialize net layer
	net_init();
		   
	// Start the CTP backends 
	ctp_proto_init();
	
	// Wait a while till the routing is possibly established      
	mos_mdelay(10);
	
	net_ioctl(CTP_PROTO_ID, CTP_SET_TESTBED);
	com_ioctl_IFACE_RADIO (CC2420_TX_POWER, 30); //set the tx power from 0 (min) to 31 (max)  
	cc2420_set_channel(26);
	printf("Running net layer and CTP backend... \n");
	
	// transportInit(true);
}
Example #30
0
void start()
{
	mos_sem_init(&send_sem, 0);
	mos_mutex_init(&send_lock);
	
	reinit();
	seqNo = 0;
	rseed = mos_node_id_get();
	send_alarm.func = alarmCallback;
    send_alarm.reset_to = 0;

	simple_fs_init();
	net_init();
	deluge_init();
	net_proto_register(77, topo_send, topo_recv, topo_ioctl);
	
	mos_command_daemon_init();
	mos_register_function("getTopo", getTopo);
	mos_thread_new_havestack(mos_command_daemon, MOS_COMMANDER_STACK_SIZE, commander_stack, PRIORITY_NORMAL);
	mos_thread_new_havestack(sendThread, 192, send_stack, PRIORITY_NORMAL);
}