int main(int argc, char **argv) { struct ndnd_handle *h; if (argc > 1) { fprintf(stderr, "%s", ndnd_usage_message); exit(1); } signal(SIGPIPE, SIG_IGN); h = ndnd_create(argv[0], stdiologger, stderr); if (h == NULL) exit(1); /*modified by zhy on 20131112*/ if(gateway_init()) { printf("gateway initial failed!\n"); exit(1); } ndnd_run(h); thread_flag=0;//recycle the thread pthread_detach(pid_listen); pthread_detach(pid_topo); close(fdusb); ndnd_msg(h, "exiting."); ndnd_destroy(&h); ERR_remove_state(0); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); exit(0); }
int dun_manager_init(DBusConnection *conn) { read_config(CONFIGDIR "/dun.conf"); if (gateway_init(conn, high_security, cmd_line) < 0) return -1; /* Register dun gateway if it doesn't exist */ btd_register_adapter_driver(&dun_gw_adapter_driver); connection = dbus_connection_ref(conn); return 0; }
int main() { gateway_init(4002); gateway_start(); getchar(); }
static void handle_uuid(const char *uuidstr, struct audio_device *device) { uuid_t uuid; uint16_t uuid16; if (bt_string2uuid(&uuid, uuidstr) < 0) { error("%s not detected as an UUID-128", uuidstr); return; } if (!sdp_uuid128_to_uuid(&uuid) && uuid.type != SDP_UUID16) { error("Could not convert %s to a UUID-16", uuidstr); return; } uuid16 = uuid.value.uuid16; if (!server_is_enabled(&device->src, uuid16)) { DBG("server not enabled for %s (0x%04x)", uuidstr, uuid16); return; } switch (uuid16) { case HEADSET_SVCLASS_ID: DBG("Found Headset record"); if (device->headset) headset_update(device, uuid16, uuidstr); else device->headset = headset_init(device, uuid16, uuidstr); break; case HEADSET_AGW_SVCLASS_ID: DBG("Found Headset AG record"); break; case HANDSFREE_SVCLASS_ID: DBG("Found Handsfree record"); if (device->headset) headset_update(device, uuid16, uuidstr); else device->headset = headset_init(device, uuid16, uuidstr); break; case HANDSFREE_AGW_SVCLASS_ID: DBG("Found Handsfree AG record"); if (enabled.gateway && (device->gateway == NULL)) device->gateway = gateway_init(device); break; case AUDIO_SINK_SVCLASS_ID: DBG("Found Audio Sink"); if (device->sink == NULL) device->sink = sink_init(device); break; case AUDIO_SOURCE_SVCLASS_ID: DBG("Found Audio Source"); if (device->source == NULL) device->source = source_init(device); break; case AV_REMOTE_SVCLASS_ID: case AV_REMOTE_TARGET_SVCLASS_ID: DBG("Found AV %s", uuid16 == AV_REMOTE_SVCLASS_ID ? "Remote" : "Target"); if (device->control) control_update(device, uuid16); else device->control = control_init(device, uuid16); /* SS_Bluetooth(sunjo4.kim) 2012.2.16 - add for a2dp connect fail */ //if (device->sink && sink_is_active(device)) // avrcp_connect(device); /* SS_Bluetooth(sunjo4.kim) End */ break; default: DBG("Unrecognized UUID: 0x%04X", uuid16); break; } }