Beispiel #1
0
PyObject *init_guava(void) {
  PyObject *guava_module = NULL;
  PyObject *request_module = NULL;
  PyObject *server_module = NULL;
  PyObject *handler_module = NULL;
  PyObject *controller_module = NULL;
  PyObject *router_module = NULL;
  PyObject *session_module = NULL;
  PyObject *cookie_module = NULL;

  PyEval_InitThreads();

  guava_module = Py_InitModule("guava", NULL);

  request_module = init_request();
  if (!register_module(guava_module, "request", request_module)) {
    return NULL;
  }

  server_module = init_server();
  if (!register_module(guava_module, "server", server_module)) {
    return NULL;
  }

  handler_module = init_handler();
  if (!register_module(guava_module, "handler", handler_module)) {
    return NULL;
  }

  router_module = init_router();
  if (!register_module(guava_module, "router", router_module)) {
    return NULL;
  }

  controller_module = init_controller();
  if (!register_module(guava_module, "controller", controller_module)) {
    return NULL;
  }

  session_module = init_session();
  if (!register_module(guava_module, "session", session_module)) {
    return NULL;
  }

  cookie_module = init_cookie();
  if (!register_module(guava_module, "cookie", cookie_module)) {
    return NULL;
  }

  PyModule_AddStringConstant(guava_module, "version", GUAVA_VERSION);

  return guava_module;
}
PROCESS_THREAD(simple_process, ev, data)
{
	PROCESS_BEGIN();

	cc2420_set_txpower(12);
	init_router(&message_received);

	static struct ctimer ct;
	ctimer_set(&ct, CLOCK_SECOND * 60 * 5, send_message_after_5_minutes, NULL);

	process_start(&neighbor_discovery_process, NULL);

	printf("K = %d, MAX_NODES = %d, MAX_EDGES = %d, LINKADDR = %d.%d\n", (int) K, (int) MAX_NODES, (int) MAX_EDGES, linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
	printf("NODE_MEM = %dB, EDGE_MEM = %dB\n", (int)(sizeof(p_node_t) * MAX_NODES), (int)(sizeof(p_edge_t) * MAX_EDGES));
	printf("PACKETBUF_SIZE = %d, TXPOWER = %d, INTERVAL = %d - %d\n", PACKETBUF_SIZE, cc2420_get_txpower(), DISCOVERY_INTERVAL_MIN, DISCOVERY_INTERVAL_MAX);

	PROCESS_END();
}