int a2dp_accept(struct bt_conn *conn, struct bt_avdtp **session) { struct bt_a2dp *a2dp_conn; a2dp_conn = get_new_connection(conn); if (!a2dp_conn) { return -ENOMEM; } *session = &(a2dp_conn->session); BT_DBG("session: %p", &(a2dp_conn->session)); return 0; }
void connection(t_client *cli, char *s) { char *token; token = split_string(s, ' ', 0); if (token != NULL) { if (strcasecmp(token, "/server") == 0) { if (!cli->is_connected) get_new_connection(cli, s); } else if (!cli->is_connected) printf("You're not connected\n"); free(token); } }
struct bt_a2dp *bt_a2dp_connect(struct bt_conn *conn) { struct bt_a2dp *a2dp_conn; int err; a2dp_conn = get_new_connection(conn); if (!a2dp_conn) { BT_ERR("Cannot allocate memory"); return NULL; } err = bt_avdtp_connect(conn, &(a2dp_conn->session)); if (err < 0) { /* If error occurs, undo the saving and return the error */ a2d_reset(a2dp_conn); BT_DBG("AVDTP Connect failed"); return NULL; } BT_DBG("Connect request sent"); return a2dp_conn; }