[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r118018 - /team/jdixon/chan_usbradio-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 22 18:53:19 CDT 2008


Author: jdixon
Date: Thu May 22 18:53:18 2008
New Revision: 118018

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118018
Log:
Working version of tm271 support

Modified:
    team/jdixon/chan_usbradio-1.4/apps/app_rpt.c

Modified: team/jdixon/chan_usbradio-1.4/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/apps/app_rpt.c?view=diff&rev=118018&r1=118017&r2=118018
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Thu May 22 18:53:18 2008
@@ -21,7 +21,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.116 5/15/08 2055 EDT
+ *  version 0.117 5/22/08 2055 EDT
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -374,7 +374,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.116  5/15/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.117  5/22/2008";
 
 static char *app = "Rpt";
 
@@ -1301,6 +1301,7 @@
 static int setkenwood(struct rpt *myrpt);
 static int set_tm271(struct rpt *myrpt);
 static int setrbi_check(struct rpt *myrpt);
+static int setxpmr(struct rpt *myrpt, int dotx);
 
 
 
@@ -4483,6 +4484,7 @@
 		}
 		else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
 		{
+			setxpmr(myrpt,0);
 			res = set_tm271(myrpt);
 		}
 		else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
@@ -4504,6 +4506,7 @@
 			if (myrpt->iofd >= 0) setdtr(myrpt->iofd,1);
 			res = setkenwood(myrpt);
 			if (myrpt->iofd >= 0) setdtr(myrpt->iofd,0);
+			setxpmr(myrpt,0);
 			if (ast_safe_sleep(mychannel,200) == -1)
 			{
 				ast_mutex_unlock(&myrpt->remlock);
@@ -7521,7 +7524,6 @@
 {
 int	i;
 
-ast_log(LOG_NOTICE,"Sent to kenwood: %s\n",txstr);
 	if (debug) printf("Send to kenwood: %s\n",txstr);
 	i = serial_remote_io(myrpt, (unsigned char *)txstr, strlen(txstr), 
 		(unsigned char *)rxstr,RAD_SERIAL_BUFLEN - 1,3);
@@ -7529,7 +7531,6 @@
 	if ((i > 0) && (rxstr[i - 1] == '\r'))
 		rxstr[i-- - 1] = 0;
 	if (debug) printf("Got from kenwood: %s\n",rxstr);
-ast_log(LOG_NOTICE,"Got from kenwood: %s\n",rxstr);
 	return(i);
 }
 
@@ -7625,6 +7626,104 @@
 	return -1;
 }
 
+/* take a PL frequency and turn it into a code */
+static int tm271_pltocode(char *str)
+{
+int i;
+char *s;
+
+	s = strchr(str,'.');
+	i = 0;
+	if (s) i = atoi(s + 1);
+	i += atoi(str) * 10;
+	switch(i)
+	{
+	    case 670:
+		return 0;
+	    case 693:
+		return 1;
+	    case 719:
+		return 2;
+	    case 744:
+		return 3;
+	    case 770:
+		return 4;
+	    case 797:
+		return 5;
+	    case 825:
+		return 6;
+	    case 854:
+		return 7;
+	    case 885:
+		return 8;
+	    case 915:
+		return 9;
+	    case 948:
+		return 10;
+	    case 974:
+		return 11;
+	    case 1000:
+		return 12;
+	    case 1035:
+		return 13;
+	    case 1072:
+		return 14;
+	    case 1109:
+		return 15;
+	    case 1148:
+		return 16;
+	    case 1188:
+		return 17;
+	    case 1230:
+		return 18;
+	    case 1273:
+		return 19;
+	    case 1318:
+		return 20;
+	    case 1365:
+		return 21;
+	    case 1413:
+		return 22;
+	    case 1462:
+		return 23;
+	    case 1514:
+		return 24;
+	    case 1567:
+		return 25;
+	    case 1622:
+		return 26;
+	    case 1679:
+		return 27;
+	    case 1738:
+		return 28;
+	    case 1799:
+		return 29;
+	    case 1862:
+		return 30;
+	    case 1928:
+		return 31;
+	    case 2035:
+		return 32;
+	    case 2065:
+		return 33;
+	    case 2107:
+		return 34;
+	    case 2181:
+		return 35;
+	    case 2257:
+		return 36;
+	    case 2291:
+		return 37;
+	    case 2336:
+		return 38;
+	    case 2418:
+		return 39;
+	    case 2503:
+		return 40;
+	}
+	return -1;
+}
+
 static int sendrxkenwood(struct rpt *myrpt, char *txstr, char *rxstr, 
 	char *cmpstr)
 {
@@ -7694,10 +7793,11 @@
 	strcpy(freq,"000000");
 	strncpy(freq,decimals,strlen(decimals));
 
-	sprintf(txstr,"VF %04d%s,4,%d,0,%d,0,0,%d,%d,000,00600000,0,0\r",
+	sprintf(txstr,"VF %04d%s,4,%d,0,%d,%d,0,%02d,%02d,000,00600000,0,0\r",
 		atoi(mhz),freq,offsets[(int)myrpt->offset],
-		(myrpt->txplon != 0),kenwood_pltocode(myrpt->txpl),
-		kenwood_pltocode(myrpt->rxpl));
+		(myrpt->txplon != 0) && (myrpt->rxplon == 0),
+		(myrpt->rxplon != 0),tm271_pltocode(myrpt->txpl),
+		tm271_pltocode(myrpt->rxpl));
 
 	if (sendrxkenwood(myrpt,txstr,rxstr,"VF") < 0) return -1;
 	if (sendrxkenwood(myrpt,"VM 0\r",rxstr,"VM") < 0) return -1;
@@ -7915,12 +8015,8 @@
 	}
 	return 0;
 }
-#if 0
-/*
-	sets current signaling code for xpmr routines
-	under development for new radios.
-*/
-static int setxpmr(struct rpt *myrpt)
+
+static int setxpmr(struct rpt *myrpt, int dotx)
 {
 	char rigstr[200];
 	int rxpl,txpl;
@@ -7943,19 +8039,28 @@
 	 	return -1;
 	}
 
-	txpl = rbi_pltocode(myrpt->txpl);
-	if (txpl == -1){
-		if(debug)
-			printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
-	 	return -1;
-	}
-	sprintf(rigstr,"SETFREQ 0.0 0.0 %s %s L",
-		(myrpt->rxplon) ? myrpt->rxpl : "0.0",
-		(myrpt->txplon) ? myrpt->txpl : "0.0");
+	if (dotx)
+	{
+		txpl = rbi_pltocode(myrpt->txpl);
+		if (txpl == -1){
+			if(debug)
+				printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
+		 	return -1;
+		}
+		sprintf(rigstr,"SETFREQ 0.0 0.0 %s %s L",
+			(myrpt->rxplon) ? myrpt->rxpl : "0.0",
+			(myrpt->txplon) ? myrpt->txpl : "0.0");
+	}
+	else
+	{
+		sprintf(rigstr,"SETFREQ 0.0 0.0 %s 0.0 L",
+			(myrpt->rxplon) ? myrpt->rxpl : "0.0");
+
+	}
 	send_usb_txt(myrpt,rigstr);
 	return 0;
 }
-#endif
+
 
 static int setrbi_check(struct rpt *myrpt)
 {
@@ -8111,7 +8216,7 @@
 	else if((m >= 145) && (m < 148)){
 		;
 	}
-		return -1;
+	else	return -1;
 	
 	if(defmode)
 		*defmode = dflmd;	
@@ -9665,7 +9770,7 @@
 				if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
 					return DC_ERROR;
 			}
-	    	r=get_mem_set(myrpt, digitbuf);
+		    	r=get_mem_set(myrpt, digitbuf);
 			if (r < 0){
 				rpt_telemetry(myrpt,MEMNOTFOUND,NULL);
 				return DC_COMPLETE;
@@ -9754,7 +9859,7 @@
 			
 			snprintf(freq, sizeof(freq), "%s.%03d%02d",s1, k, ht);
 
-			if(debug)
+ 			if(debug) 
 				ast_log(LOG_NOTICE, "New frequency: %s\n", freq);
 	
 			split_freq(mhz, decimals, freq);
@@ -9763,7 +9868,6 @@
 
 			if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */
 			        goto invalid_freq;
-
 
  			if((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */
 				break; /* Not yet */
@@ -15207,3 +15311,4 @@
 	       );
 #endif
 
+




More information about the asterisk-commits mailing list