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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 12 23:25:38 CDT 2008


Author: jdixon
Date: Mon May 12 23:25:37 2008
New Revision: 115844

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115844
Log:
Added support for Kenwood tm-271 radio

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=115844&r1=115843&r2=115844
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Mon May 12 23:25:37 2008
@@ -21,7 +21,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.114 5/11/08 2055 EDT
+ *  version 0.115 5/12/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.114  5/11/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.115  5/12/2008";
 
 static char *app = "Rpt";
 
@@ -461,6 +461,7 @@
 static char *remote_rig_ft897="ft897";
 static char *remote_rig_rbi="rbi";
 static char *remote_rig_kenwood="kenwood";
+static char *remote_rig_tm271="tm271";
 static char *remote_rig_ic706="ic706";
 static char *remote_rig_rtx150="rtx150";
 static char *remote_rig_rtx450="rtx450";
@@ -1298,6 +1299,7 @@
 static int set_ft897(struct rpt *myrpt);
 static int set_ic706(struct rpt *myrpt);
 static int setkenwood(struct rpt *myrpt);
+static int set_tm271(struct rpt *myrpt);
 static int setrbi_check(struct rpt *myrpt);
 
 
@@ -4479,7 +4481,11 @@
 		{
 			res = set_ft897(myrpt);
 		}
-		if(!strcmp(myrpt->remoterig, remote_rig_ic706))
+		else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
+		{
+			res = set_tm271(myrpt);
+		}
+		else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
 		{
 			res = set_ic706(myrpt);
 		}
@@ -7513,6 +7519,7 @@
 {
 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);
@@ -7520,6 +7527,7 @@
 	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);
 }
 
@@ -7672,6 +7680,30 @@
 	return 0;
 }
 
+static int set_tm271(struct rpt *myrpt)
+{
+char rxstr[RAD_SERIAL_BUFLEN],txstr[RAD_SERIAL_BUFLEN],freq[20];
+char mhz[MAXREMSTR],decimals[MAXREMSTR];
+	
+int offsets[] = {0,2,1};
+int powers[] = {2,1,0};
+
+	split_freq(mhz, decimals, myrpt->freq);
+	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",
+		atoi(mhz),freq,offsets[(int)myrpt->offset],
+		(myrpt->txplon != 0),kenwood_pltocode(myrpt->txpl),
+		kenwood_pltocode(myrpt->rxpl));
+
+	if (sendrxkenwood(myrpt,txstr,rxstr,"VF") < 0) return -1;
+	if (sendrxkenwood(myrpt,"VM 0\r",rxstr,"VM") < 0) return -1;
+	sprintf(txstr,"PC %d\r",powers[(int)myrpt->powerlevel]);
+	if (sendrxkenwood(myrpt,txstr,rxstr,"PC") < 0) return -1;
+	return 0;
+}
+
 static int setrbi(struct rpt *myrpt)
 {
 char tmp[MAXREMSTR] = "",*s;
@@ -8056,6 +8088,27 @@
 		;
 	}
 	else
+		return -1;
+	
+	if(defmode)
+		*defmode = dflmd;	
+
+
+	return 0;
+}
+
+
+static int check_freq_tm271(int m, int d, int *defmode)
+{
+	int dflmd = REM_MODE_FM;
+
+	if (m == 144){ /* 2 meters */
+		if(d < 10100)
+			return -1;
+	}
+	else if((m >= 145) && (m < 148)){
+		;
+	}
 		return -1;
 	
 	if(defmode)
@@ -9210,6 +9263,11 @@
 		rpt_telemetry(myrpt,SETREMOTE,NULL);
 		res = 0;
 	}
+	if(!strcmp(myrpt->remoterig, remote_rig_tm271))
+	{
+		rpt_telemetry(myrpt,SETREMOTE,NULL);
+		res = 0;
+	}
 	else if(!strcmp(myrpt->remoterig, remote_rig_rbi))
 	{
 		res = setrbi_check(myrpt);
@@ -9258,6 +9316,8 @@
 		return check_freq_rbi(m, d, defmode);
 	else if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
 		return check_freq_kenwood(m, d, defmode);
+	else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
+		return check_freq_tm271(m, d, defmode);
 	else if(ISRIG_RTX(myrpt->remoterig))
 		return check_freq_rtx(m, d, defmode, myrpt);
 	else
@@ -13854,8 +13914,9 @@
 		ioctl(myrpt->zaptxchannel->fds[0],ZT_HOOK,&i);
 		/* if PCIRADIO and Yaesu ft897/ICOM IC-706 selected */
 		if ((myrpt->iofd < 1) && (!res) &&
-		   (!strcmp(myrpt->remoterig,remote_rig_ft897) ||
-		      (!strcmp(myrpt->remoterig,remote_rig_ic706))))
+		   ((!strcmp(myrpt->remoterig,remote_rig_ft897)) ||
+		      (!strcmp(myrpt->remoterig,remote_rig_ic706)) ||
+		         (!strcmp(myrpt->remoterig,remote_rig_tm271))))
 		{
 			z.radpar = ZT_RADPAR_UIOMODE;
 			z.data = 1;




More information about the asterisk-commits mailing list