[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r805 - /team/mnicholson/ch...

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Fri Mar 13 11:42:10 CDT 2009


Author: mnicholson
Date: Fri Mar 13 11:42:07 2009
New Revision: 805

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=805
Log:
whitespace and formatting fixes

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=805&r1=804&r2=805
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Fri Mar 13 11:42:07 2009
@@ -194,7 +194,7 @@
 static char *mblstatus_desc =
 "MobileStatus(Device,Variable)\n"
 "  Device - Id of mobile device from mobile.conf\n"
-"  Variable - Variable to store status in will be 1-3.\n" 
+"  Variable - Variable to store status in will be 1-3.\n"
 "             In order, Disconnected, Connected & Free, Connected & Busy.\n";
 
 static char *app_mblsendsms = "MobileSendSMS";
@@ -474,7 +474,7 @@
 	case CLI_INIT:
 		e->command = "mobile show devices";
 		e->usage =
-			"Usage: mobile show devices\n" 
+			"Usage: mobile show devices\n"
 			"       Shows the state of Bluetooth Cell / Mobile devices.\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -525,7 +525,7 @@
 	case CLI_INIT:
 		e->command = "mobile search";
 		e->usage =
-			"Usage: mobile search\n" 
+			"Usage: mobile search\n"
 			"       Searches for Bluetooth Cell / Mobile devices in range.\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -1055,7 +1055,7 @@
 	}
 
 	ast_smoother_feed(pvt->smoother, frame);
-	
+
 	while ((f = ast_smoother_read(pvt->smoother))) {
 		sco_write(pvt->sco_socket, f->data.ptr, f->datalen);
 		ast_frfree(f);
@@ -1190,7 +1190,8 @@
 
 */
 
-static int rfcomm_connect(bdaddr_t src, bdaddr_t dst, int remote_channel) {
+static int rfcomm_connect(bdaddr_t src, bdaddr_t dst, int remote_channel)
+{
 
 	struct sockaddr_rc addr;
 	int s;
@@ -1284,7 +1285,7 @@
 	outfd = ast_waitfor_n_fd(&rsock, 1, ms, &exception);
 	if (outfd < 0)
 		outfd = 0;
-	
+
 	return outfd;
 }
 
@@ -1584,7 +1585,7 @@
 	struct mbl_pvt *pvt = (struct mbl_pvt *) data;
 	int res;
 	char buf[DEVICE_FRAME_SIZE];
-	
+
 	ast_debug(2, "sco_read()\n");
 
 	if ((res = read(fd, buf, DEVICE_FRAME_SIZE)) <= 0) {
@@ -1622,7 +1623,7 @@
 	char saddr[18];
 	struct sco_options so;
 	int sock;
-					
+
 	addrlen = sizeof(struct sockaddr_sco);
 	if ((sock = accept(fd, (struct sockaddr *)&addr, &addrlen)) == -1) {
 		ast_log(LOG_ERROR, "error accepting audio connection on adapter %s\n", adapter->id);
@@ -1639,7 +1640,7 @@
 	pvt = NULL;
 	AST_RWLIST_RDLOCK(&devices);
 	AST_RWLIST_TRAVERSE(&devices, pvt, entry) {
-		if (!bacmp(&pvt->addr, &addr.sco_bdaddr)) 
+		if (!bacmp(&pvt->addr, &addr.sco_bdaddr))
 			break;
 	}
 	AST_RWLIST_UNLOCK(&devices);
@@ -1679,7 +1680,7 @@
 		ast_log(LOG_ERROR, "Unable to create sco listener socket for adapter %s.\n", adapter->id);
 		goto e_return;
 	}
-	
+
 	memset(&addr, 0, sizeof(addr));
 	addr.sco_family = AF_BLUETOOTH;
 	bacpy(&addr.sco_bdaddr, &adapter->addr);
@@ -1878,7 +1879,7 @@
 			ast_debug(1, "[%s] error performing CIND test\n", hfp->owner->id);
 		return -1;
 	}
-	
+
 	/* read current CIND state */
 	if (hfp_send_cind(hfp) || !hfp_wait(hfp) || hfp_read_cind(hfp)) {
 		ast_debug(1, "[%s] error getting CIND state\n", hfp->owner->id);
@@ -1898,7 +1899,7 @@
 			return -1;
 		}
 	}
-	
+
 	/* enalbe calling line identification notification */
 	if (hfp_send_clip(hfp, 1) || !hfp_wait(hfp) || at_read(hfp->rsock) != AT_OK) {
 		ast_debug(1, "[%s] error enabling calling line notification\n", hfp->owner->id);
@@ -1910,7 +1911,7 @@
 		ast_debug(1, "[%s] error synchronizing gain settings\n", hfp->owner->id);
 		return -1;
 	}
-	
+
 	/* we now have a service level connection */
 	hfp->connected = 1;
 
@@ -1988,7 +1989,8 @@
  * inforamtion in buf
  * success
  */
-static char *hfp_parse_clip(struct hfp_pvt *hfp, char *buf) {
+static char *hfp_parse_clip(struct hfp_pvt *hfp, char *buf)
+{
 	int i, state;
 	char *clip;
 	size_t s;
@@ -2032,7 +2034,8 @@
  * @note buf will be modified when the CMTI message is parsed
  * \return -1 on error (parse error) or the index of the new sms message
  */
-static int hfp_parse_cmti(struct hfp_pvt *hfp, char *buf) {
+static int hfp_parse_cmti(struct hfp_pvt *hfp, char *buf)
+{
 	int index;
 	char mem[8];
 
@@ -2151,7 +2154,7 @@
 	ag->status = brsf & HFP_AG_STATUS ? 1 : 0;
 	ag->control = brsf & HFP_AG_CONTROL ? 1 : 0;
 	ag->errors = brsf & HFP_AG_ERRORS ? 1 : 0;
-	
+
 	return ag;
 }
 
@@ -2397,12 +2400,12 @@
 		ast_debug(1, "ignoring CIND state '%s' for group %d, we only support up to %d indicators\n", indicator, group, (int) sizeof(hfp->cind_state));
 		return -1;
 	}
-	
+
 	if (!sscanf(indicator, "%d", &value)) {
 		ast_debug(1, "error parsing CIND state '%s' for group %d\n", indicator, group);
 		return -1;
 	}
-	
+
 	hfp->cind_state[group] = value;
 	return 0;
 }
@@ -2458,7 +2461,7 @@
 	/* store the last indicator */
 	if (state == 2)
 		hfp_parse_cind_indicator(hfp, group, indicator);
-	
+
 	/* read the OK message */
 	if (!hfp_wait(hfp) || at_read(hfp->rsock) != AT_OK)
 		return -1;
@@ -2567,7 +2570,7 @@
 	}
 
 	hfp->owner->no_callsetup = hfp->nocallsetup;
-	
+
 	/* read the OK message */
 	if (!hfp_wait(hfp) || at_read(hfp->rsock) != AT_OK)
 		return -1;
@@ -3316,7 +3319,7 @@
 	pvt->adapter->inuse = 0;
 	ast_mutex_unlock(&pvt->lock);
 
-	ast_verb(3, "Bluetooth Device %s has disconnected.\n", pvt->id); 
+	ast_verb(3, "Bluetooth Device %s has disconnected.\n", pvt->id);
 	manager_event(EVENT_FLAG_SYSTEM, "MobileStatus", "Status: Disconnect\r\nDevice: %s\r\n", pvt->id);
 
 	return NULL;
@@ -3344,13 +3347,13 @@
 			t = 2000;
 		else
 			t = 1000;
-		
+
 		if (!ast_io_wait(io, t) && rfcomm_wait(pvt->rfcomm_socket, &zero)) {
 			if ((at_msg = at_read_full(pvt->rfcomm_socket, buf, sizeof(buf))) < 0) {
 				if (strerror_r(errno, buf, sizeof(buf)))
-					ast_debug(1, "[%s] error reading from device\n", pvt->id); 
+					ast_debug(1, "[%s] error reading from device\n", pvt->id);
 				else
-					ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, buf, errno); 
+					ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, buf, errno);
 
 				break;
 			}
@@ -3362,7 +3365,7 @@
 					ast_queue_control(pvt->owner, AST_CONTROL_ANSWER);
 					pvt->state = MBL_STATE_INCOMING;
 					if (hsp_send_vgs(pvt->rfcomm_socket, 13) || hsp_send_vgm(pvt->rfcomm_socket, 13)) {
-						ast_debug(1, "[%s] error sending VGS/VGM\n", pvt->id); 
+						ast_debug(1, "[%s] error sending VGS/VGM\n", pvt->id);
 						break;
 					}
 				}
@@ -3382,7 +3385,7 @@
 				hsp_send_ok(pvt->rfcomm_socket);
 			} else if (at_msg == AT_UNKNOWN) {
 				if (hsp_send_error(pvt->rfcomm_socket)) {
-					ast_debug(1, "[%s] error sending ERROR\n", pvt->id); 
+					ast_debug(1, "[%s] error sending ERROR\n", pvt->id);
 					break;
 				}
 			}
@@ -3408,7 +3411,7 @@
 				}
 			} else if (pvt->state == MBL_STATE_RING2) {
 				if (hsp_send_ring(pvt->rfcomm_socket)) {
-					ast_debug(1, "[%s] error sending RING\n", pvt->id); 
+					ast_debug(1, "[%s] error sending RING\n", pvt->id);
 					break;
 				}
 			}
@@ -3427,7 +3430,7 @@
 	pvt->connected = 0;
 
 	manager_event(EVENT_FLAG_SYSTEM, "MobileStatus", "Status: Disconnect\r\nDevice: %s\r\n", pvt->id);
-	ast_verb(3, "Bluetooth Device %s has disconnected\n", pvt->id); 
+	ast_verb(3, "Bluetooth Device %s has disconnected\n", pvt->id);
 
 	pvt->adapter->inuse = 0;
 
@@ -3440,7 +3443,7 @@
 
 	if (pvt->type == MBL_TYPE_PHONE) {
 		pvt->hfp->rsock = pvt->rfcomm_socket;
-	
+
 		if (ast_pthread_create_background(&pvt->monitor_thread, NULL, do_monitor_phone, pvt) < 0) {
 			pvt->monitor_thread = AST_PTHREADT_NULL;
 			return 0;
@@ -3520,7 +3523,7 @@
 			break;
 		}
 	}
-	
+
 	return NULL;
 }
 
@@ -3861,7 +3864,7 @@
 
 	/* First, take us out of the channel loop */
 	ast_channel_unregister(&mbl_tech);
-	
+
 	/* Unregister the CLI & APP */
 	ast_cli_unregister_multiple(mbl_cli, sizeof(mbl_cli) / sizeof(mbl_cli[0]));
 	ast_unregister_application(app_mblstatus);
@@ -3883,7 +3886,7 @@
 		pthread_join(adapter->sco_listener_thread, NULL);
 	}
 	AST_RWLIST_UNLOCK(&adapters);
-	
+
 	/* Destroy the device list */
 	AST_RWLIST_WRLOCK(&devices);
 	while ((pvt = AST_RWLIST_REMOVE_HEAD(&devices, entry))) {
@@ -3945,7 +3948,7 @@
 		ast_log(LOG_ERROR, "Errors reading config file %s. Not loading module.\n", MBL_CONFIG);
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	sdp_session = sdp_register();
 
 	/* Spin the discovery thread */




More information about the asterisk-addons-commits mailing list