hsp_hs.c (c169df2f885b47a4b0894cfd04e316df94bbf2f2) hsp_hs.c (08ecd8bd8cf622cbf1e1ef22bd89cf84c35c0653)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 298 unchanged lines hidden (view full) ---

307 return;
308 }
309
310 if (hsp_state == HSP_W4_RFCOMM_CONNECTED){
311 hsp_state = HSP_W4_CONNECTION_ESTABLISHED_TO_SHUTDOWN;
312 return;
313 }
314
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 298 unchanged lines hidden (view full) ---

307 return;
308 }
309
310 if (hsp_state == HSP_W4_RFCOMM_CONNECTED){
311 hsp_state = HSP_W4_CONNECTION_ESTABLISHED_TO_SHUTDOWN;
312 return;
313 }
314
315 if (hsp_state < HSP_W4_SCO_CONNECTED){
316 hsp_state = HSP_W2_DISCONNECT_RFCOMM;
317 return;
318 }
319
320 hsp_disconnect_rfcomm = 1;
321 hsp_run();
315 hsp_establish_audio_connection = 0;
316 rfcomm_disconnect(rfcomm_cid);
322}
323
324
325void hsp_hs_establish_audio_connection(void){
326 switch (hsp_state){
327 case HSP_RFCOMM_CONNECTION_ESTABLISHED:
328 hsp_establish_audio_connection = 1;
329 hsp_state = HSP_W4_SCO_CONNECTED;

--- 74 unchanged lines hidden (view full) ---

404 return;
405 }
406 hsp_release_audio_connection = 0;
407 wait_ok = 1;
408 hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_AT_CKPD);
409 return;
410 }
411
317}
318
319
320void hsp_hs_establish_audio_connection(void){
321 switch (hsp_state){
322 case HSP_RFCOMM_CONNECTION_ESTABLISHED:
323 hsp_establish_audio_connection = 1;
324 hsp_state = HSP_W4_SCO_CONNECTED;

--- 74 unchanged lines hidden (view full) ---

399 return;
400 }
401 hsp_release_audio_connection = 0;
402 wait_ok = 1;
403 hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_AT_CKPD);
404 return;
405 }
406
412 if (hsp_disconnect_rfcomm){
413 hsp_disconnect_rfcomm = 0;
414 hsp_establish_audio_connection = 0;
415 rfcomm_disconnect(rfcomm_cid);
416 return;
417 }
418
419 if (hsp_establish_audio_connection){
420 if (!rfcomm_can_send_packet_now(rfcomm_cid)) {
421 rfcomm_request_can_send_now_event(rfcomm_cid);
422 return;
423 }
424 hsp_establish_audio_connection = 0;
425 wait_ok = 1;
426 hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_AT_CKPD);

--- 266 unchanged lines hidden ---
407 if (hsp_establish_audio_connection){
408 if (!rfcomm_can_send_packet_now(rfcomm_cid)) {
409 rfcomm_request_can_send_now_event(rfcomm_cid);
410 return;
411 }
412 hsp_establish_audio_connection = 0;
413 wait_ok = 1;
414 hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_AT_CKPD);

--- 266 unchanged lines hidden ---