static void stdin_process(char cmd){ uint8_t status = ERROR_CODE_SUCCESS; remote_seid = 1; is_cmd_triggered_localy = 1; switch (cmd){ case 'c': printf("Establish AVDTP Sink connection to %s\n", device_addr_string); status = avdtp_sink_connect(device_addr, &avdtp_cid); break; case 'C': printf("Disconnect AVDTP Sink\n"); status = avdtp_sink_disconnect(avdtp_cid); break; case 'd': printf("Discover stream endpoints of %s\n", device_addr_string); status = avdtp_sink_discover_stream_endpoints(avdtp_cid); break; case 'g': printf("Get capabilities of stream endpoint with seid %d\n", remote_seid); status = avdtp_sink_get_capabilities(avdtp_cid, remote_seid); break; case 'a': printf("Get all capabilities of stream endpoint with seid %d\n", remote_seid); status = avdtp_sink_get_all_capabilities(avdtp_cid, remote_seid); break; case 'f': printf("Get configuration of stream endpoint with seid %d\n", remote_seid); status = avdtp_sink_get_configuration(avdtp_cid, remote_seid); break; case 's': printf("Set configuration of stream endpoint with seid %d\n", remote_seid); remote_configuration_bitmap = store_bit16(remote_configuration_bitmap, AVDTP_MEDIA_CODEC, 1); remote_configuration.media_codec.media_type = AVDTP_AUDIO; remote_configuration.media_codec.media_codec_type = AVDTP_CODEC_SBC; remote_configuration.media_codec.media_codec_information_len = sizeof(media_sbc_codec_configuration); remote_configuration.media_codec.media_codec_information = media_sbc_codec_configuration; status = avdtp_sink_set_configuration(avdtp_cid, local_seid, remote_seid, remote_configuration_bitmap, remote_configuration); break; case 'R': printf("Reconfigure stream endpoint with seid %d\n", remote_seid); remote_configuration_bitmap = 0; remote_configuration_bitmap = store_bit16(remote_configuration_bitmap, AVDTP_MEDIA_CODEC, 1); remote_configuration.media_codec.media_type = AVDTP_AUDIO; remote_configuration.media_codec.media_codec_type = AVDTP_CODEC_SBC; remote_configuration.media_codec.media_codec_information_len = sizeof(media_sbc_codec_reconfiguration); remote_configuration.media_codec.media_codec_information = media_sbc_codec_reconfiguration; status = avdtp_sink_reconfigure(avdtp_cid, local_seid, remote_seid, remote_configuration_bitmap, remote_configuration); break; case 'o': printf("Establish stream between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_open_stream(avdtp_cid, local_seid, remote_seid); break; case 'm': printf("Start stream between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_start_stream(avdtp_cid, local_seid); break; case 'A': printf("Abort stream between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_abort_stream(avdtp_cid, local_seid); break; case 'S': printf("Release stream between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_stop_stream(avdtp_cid, local_seid); break; case 'P': printf("Suspend stream between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_suspend(avdtp_cid, local_seid); break; case 'D': printf("Send delay report between local %d and remote %d seid\n", local_seid, remote_seid); status = avdtp_sink_delay_report(avdtp_cid, remote_seid, 100); break; case '\n': case '\r': is_cmd_triggered_localy = 0; break; default: is_cmd_triggered_localy = 0; show_usage(); break; } if (status != ERROR_CODE_SUCCESS){ printf("AVDTP Sink cmd \'%c\' failed, status 0x%02x\n", cmd, status); } }
static void stdin_process(char cmd){ remote_seid = 1; switch (cmd){ case 'c': printf("Establish AVDTP Sink connection to %s\n", device_addr_string); avdtp_sink_connect(device_addr, &avdtp_cid); break; case 'C': printf("Disconnect AVDTP Sink\n"); avdtp_sink_disconnect(avdtp_cid); break; case 'd': printf("Discover stream endpoints of %s\n", device_addr_string); avdtp_sink_discover_stream_endpoints(avdtp_cid); break; case 'g': printf("Get capabilities of stream endpoint with seid %d\n", remote_seid); avdtp_sink_get_capabilities(avdtp_cid, remote_seid); break; case 'a': printf("Get all capabilities of stream endpoint with seid %d\n", remote_seid); avdtp_sink_get_all_capabilities(avdtp_cid, remote_seid); break; case 'f': printf("Get configuration of stream endpoint with seid %d\n", remote_seid); avdtp_sink_get_configuration(avdtp_cid, remote_seid); break; case 's': printf("Set configuration of stream endpoint with seid %d\n", remote_seid); remote_configuration_bitmap = store_bit16(remote_configuration_bitmap, AVDTP_MEDIA_CODEC, 1); remote_configuration.media_codec.media_type = AVDTP_AUDIO; remote_configuration.media_codec.media_codec_type = AVDTP_CODEC_SBC; remote_configuration.media_codec.media_codec_information_len = sizeof(media_sbc_codec_configuration); remote_configuration.media_codec.media_codec_information = media_sbc_codec_configuration; avdtp_sink_set_configuration(avdtp_cid, local_seid, remote_seid, remote_configuration_bitmap, remote_configuration); break; case 'R': printf("Reconfigure stream endpoint with seid %d\n", remote_seid); remote_configuration_bitmap = store_bit16(remote_configuration_bitmap, AVDTP_MEDIA_CODEC, 1); remote_configuration.media_codec.media_type = AVDTP_AUDIO; remote_configuration.media_codec.media_codec_type = AVDTP_CODEC_SBC; remote_configuration.media_codec.media_codec_information_len = sizeof(media_sbc_codec_reconfiguration); remote_configuration.media_codec.media_codec_information = media_sbc_codec_reconfiguration; avdtp_sink_reconfigure(avdtp_cid, local_seid, remote_seid, remote_configuration_bitmap, remote_configuration); break; case 'o': printf("Establish stream between local %d and remote %d seid\n", local_seid, remote_seid); avdtp_sink_open_stream(avdtp_cid, local_seid, remote_seid); break; case 'm': printf("Start stream between local %d and remote %d seid\n", local_seid, remote_seid); avdtp_sink_start_stream(avdtp_cid, local_seid); break; case 'A': printf("Abort stream between local %d and remote %d seid\n", local_seid, remote_seid); avdtp_sink_abort_stream(avdtp_cid, local_seid); break; case 'S': printf("Release stream between local %d and remote %d seid\n", local_seid, remote_seid); avdtp_sink_stop_stream(avdtp_cid, local_seid); break; case 'P': printf("Susspend stream between local %d and remote %d seid\n", local_seid, remote_seid); avdtp_sink_suspend(avdtp_cid, local_seid); break; case '\n': case '\r': break; default: show_usage(); break; } }