[svn-commits] mnicholson: branch mnicholson/chan-mobile-refactor r745 - /team/mnicholson/ch...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 26 11:47:40 CST 2009


Author: mnicholson
Date: Mon Jan 26 11:47:39 2009
New Revision: 745

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=745
Log:
Updated for new rfcomm_wait() behavior

Modified:
    team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c

Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=745&r1=744&r2=745
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Mon Jan 26 11:47:39 2009
@@ -1353,12 +1353,12 @@
 		else
 			t = 1000;
 
-		waitfd = rfcomm_wait(pvt->rfcomm_socket, &t);
-
-		if (waitfd == pvt->rfcomm_socket) {
+		if (waitfd = rfcomm_wait(pvt->rfcomm_socket, &t)) {
 			s = rfcomm_read(pvt->rfcomm_socket, buf, sizeof(buf));
 
 			if (s < 1) {
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3  "Bluetooth Device %s has disconnected, reason (%d).\n", pvt->id, errno); 
 				monitor = 0;
 				continue;
 			}
@@ -1633,7 +1633,7 @@
 				}
 			}
 
-		} else if (waitfd = -1) { /* Timeouts */
+		} else { /* Timeouts */
 			if (pvt->state == MBL_STATE_INIT2) { /* Some devices dont respond to AT+CIND? properly. RIM Blackberry 4 example */
 				pvt->state++;
 				rfcomm_write(pvt->rfcomm_socket, "AT+CMER=3,0,0,1\r");
@@ -1687,12 +1687,7 @@
 				ast_log(LOG_ERROR, "Failed to send SMS to %s on device %s\n", pvt->dial_number, pvt->id);
 				pvt->state = MBL_STATE_IDLE;
 			}
-		} else if (waitfd == 0) {
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3  "Bluetooth Device %s has disconnected, reason (%d).\n", pvt->id, errno); 
-			monitor = 0;
-		}
-
+		}
 	}
 
 	if (pvt->rfcomm_socket > -1)
@@ -1735,12 +1730,12 @@
 		else
 			t = 1000;
 		
-		waitfd = rfcomm_wait(pvt->rfcomm_socket, &t);
-
-		if (waitfd == pvt->rfcomm_socket) {
+		if (waitfd = rfcomm_wait(pvt->rfcomm_socket, &t)) {
 			s = rfcomm_read(pvt->rfcomm_socket, buf, sizeof(buf));
 
 			if (s < 1) {
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3  "Bluetooth Device %s has disconnected, reason (%d).\n", pvt->id, errno); 
 				monitor = 0;
 				continue;
 			}
@@ -1774,7 +1769,7 @@
 			} else if (strstr(buf, "AT+VGM=")) {
 				rfcomm_write(pvt->rfcomm_socket, "\r\nOK\r\n");
 			}
-		} else if (waitfd == -1) {	/* Timeouts */
+		} else {	/* Timeouts */
 			if (pvt->state == MBL_STATE_PREIDLE) {
 				pvt->connected = 1;
 				ast_verbose(VERBOSE_PREFIX_3 "Bluetooth Device %s initialised and ready.\n", pvt->id);
@@ -1791,10 +1786,6 @@
 			} else if (pvt->state == MBL_STATE_RING2) {
 				rfcomm_write(pvt->rfcomm_socket, "\r\nRING\r\n");
 			}
-		} else if (waitfd == 0) {
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3  "Bluetooth Device %s has disconnected, reason (%d).\n", pvt->id, errno); 
-			monitor = 0;
 		}
 
 	}




More information about the svn-commits mailing list