[Hamlib-cvs-digest] CVS: hamlib/icom frame.c,1.5,1.6 frame.h,1.3,1.4 icom.c,1.9,1.10 icom.h,1.8,1.9
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Stephane F. <f4...@us...> - 2000-12-04 23:39:21
|
Update of /cvsroot/hamlib/hamlib/icom In directory slayer.i.sourceforge.net:/tmp/cvs-serv6495/icom Modified Files: frame.c frame.h icom.c icom.h Log Message: * removed [sg]et_passband in favor of an enhanced [sg]et_mode which includes the passband, since most rigs tie these parameters together quite often. For exemple, WFM is (RIG_MODE_FM,RIG_PASSBAND_WIDE) in Hamlib. Another set of functions will be needed to fine tune aditional frequency response/filters. Index: frame.c =================================================================== RCS file: /cvsroot/hamlib/hamlib/icom/frame.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** frame.c 2000/11/01 23:21:47 1.5 --- frame.c 2000/12/04 23:39:17 1.6 *************** *** 195,199 **** ! unsigned short hamlib2icom_mode(rmode_t mode) { int icmode, icmode_ext; --- 195,202 ---- ! /* ! * TODO: be more exhaustive ! */ ! unsigned short hamlib2icom_mode(rmode_t mode, pbwidth_t width) { int icmode, icmode_ext; *************** *** 207,228 **** case RIG_MODE_LSB: icmode = S_LSB; break; case RIG_MODE_RTTY: icmode = S_RTTY; break; ! case RIG_MODE_FM: icmode = S_FM; break; ! #if 0 ! case RIG_MODE_WFM: icmode = S_WFM; break; ! ! case RIG_MODE_NFM: icmode = S_FM; icmode_ext = 0x01; break; ! case RIG_MODE_NAM: icmode = S_AM; break; ! case RIG_MODE_WAM: icmode = S_AM; break; ! case RIG_MODE_NCW: icmode = S_CW; break; ! case RIG_MODE_WCW: icmode = S_CW; break; ! case RIG_MODE_CWR: icmode = S_CW; break; ! case RIG_MODE_NUSB: icmode = S_USB; break; ! case RIG_MODE_WUSB: icmode = S_USB; break; ! case RIG_MODE_NLSB: icmode = S_LSB; break; ! case RIG_MODE_WLSB: icmode = S_LSB; break; ! case RIG_MODE_NRTTY: icmode = S_RTTY; break; ! case RIG_MODE_WRTTY: icmode = S_RTTY; break; ! #endif ! default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Hamlib mode %d\n",mode); --- 210,217 ---- case RIG_MODE_LSB: icmode = S_LSB; break; case RIG_MODE_RTTY: icmode = S_RTTY; break; ! case RIG_MODE_FM: ! icmode = width==RIG_PASSBAND_WIDE?S_WFM:S_FM; ! icmode_ext = width==RIG_PASSBAND_NARROW?0x01:0x00; ! break; default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Hamlib mode %d\n",mode); *************** *** 232,247 **** } ! rmode_t icom2hamlib_mode(unsigned short icmode) { ! rmode_t mode; switch (icmode & 0xff) { ! case S_AM: mode = RIG_MODE_AM; break; ! case S_CW: mode = RIG_MODE_CW; break; ! case S_FM: mode = RIG_MODE_FM; break; ! case S_WFM: mode = RIG_MODE_FM; break; /* and set width to wide.. */ ! case S_USB: mode = RIG_MODE_USB; break; ! case S_LSB: mode = RIG_MODE_LSB; break; ! case S_RTTY: mode = RIG_MODE_RTTY; break; case 0xff: mode = 0; break; /* blank mem channel */ --- 221,239 ---- } ! void icom2hamlib_mode(unsigned short icmode, rmode_t *mode, pbwidth_t *width) { ! *width = RIG_PASSBAND_NORMAL; switch (icmode & 0xff) { ! case S_AM: *mode = RIG_MODE_AM; break; ! case S_CW: *mode = RIG_MODE_CW; break; ! case S_FM: *mode = RIG_MODE_FM; break; ! case S_WFM: ! *mode = RIG_MODE_FM; ! *width = RIG_PASSBAND_WIDE; ! break; ! case S_USB: *mode = RIG_MODE_USB; break; ! case S_LSB: *mode = RIG_MODE_LSB; break; ! case S_RTTY: *mode = RIG_MODE_RTTY; break; case 0xff: mode = 0; break; /* blank mem channel */ *************** *** 249,255 **** rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode %#.2x\n", icmode); ! mode = 0; } - return mode; } --- 241,246 ---- rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode %#.2x\n", icmode); ! *mode = 0; } } Index: frame.h =================================================================== RCS file: /cvsroot/hamlib/hamlib/icom/frame.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** frame.h 2000/11/01 23:21:47 1.3 --- frame.h 2000/12/04 23:39:17 1.4 *************** *** 39,44 **** int read_icom_frame(FILE *stream, unsigned char rxbuffer[], int timeout); ! unsigned short hamlib2icom_mode(rmode_t mode); ! rmode_t icom2hamlib_mode(unsigned short icmode); #endif /* _FRAME_H */ --- 39,44 ---- int read_icom_frame(FILE *stream, unsigned char rxbuffer[], int timeout); ! unsigned short hamlib2icom_mode(rmode_t mode, pbwidth_t width); ! void icom2hamlib_mode(unsigned short icmode, rmode_t *mode, pbwidth_t *width); #endif /* _FRAME_H */ Index: icom.c =================================================================== RCS file: /cvsroot/hamlib/hamlib/icom/icom.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** icom.c 2000/10/29 16:25:56 1.9 --- icom.c 2000/12/04 23:39:17 1.10 *************** *** 355,359 **** * Assumes rig!=NULL, rig->state.priv!=NULL */ ! int icom_set_mode(RIG *rig, rmode_t mode) { struct icom_priv_data *priv; --- 355,359 ---- * Assumes rig!=NULL, rig->state.priv!=NULL */ ! int icom_set_mode(RIG *rig, rmode_t mode, pbwidth_t width) { struct icom_priv_data *priv; *************** *** 365,369 **** priv = (struct icom_priv_data*)rig_s->priv; ! icmode = hamlib2icom_mode(mode); icom_transaction (rig, C_SET_MODE, icmode, NULL, 0, ackbuf, &ack_len); --- 365,369 ---- priv = (struct icom_priv_data*)rig_s->priv; ! icmode = hamlib2icom_mode(mode,width); icom_transaction (rig, C_SET_MODE, icmode, NULL, 0, ackbuf, &ack_len); *************** *** 380,386 **** /* * icom_get_mode ! * Assumes rig!=NULL, rig->state.priv!=NULL, mode!=NULL */ ! int icom_get_mode(RIG *rig, rmode_t *mode) { struct icom_priv_data *priv; --- 380,386 ---- /* * icom_get_mode ! * Assumes rig!=NULL, rig->state.priv!=NULL, mode!=NULL, width!=NULL */ ! int icom_get_mode(RIG *rig, rmode_t *mode, pbwidth_t *width) { struct icom_priv_data *priv; *************** *** 404,408 **** } ! *mode = icom2hamlib_mode(modebuf[1]| modebuf[2]<<8); return RIG_OK; --- 404,408 ---- } ! icom2hamlib_mode(modebuf[1]| modebuf[2]<<8, mode, width); return RIG_OK; *************** *** 1031,1035 **** chan_len = 3+freq_len+1; ! icmode = hamlib2icom_mode(chan->mode); chanbuf[chan_len++] = icmode&0xff; chanbuf[chan_len++] = icmode>>8; --- 1031,1035 ---- chan_len = 3+freq_len+1; ! icmode = hamlib2icom_mode(chan->mode, RIG_PASSBAND_NORMAL); /* FIXME */ chanbuf[chan_len++] = icmode&0xff; chanbuf[chan_len++] = icmode>>8; *************** *** 1062,1065 **** --- 1062,1066 ---- unsigned char chanbuf[24]; int chan_len,freq_len; + pbwidth_t width; /* FIXME */ rig_s = &rig->state; *************** *** 1090,1094 **** chan_len = 4+freq_len+1; ! chan->mode = icom2hamlib_mode(chanbuf[chan_len] | chanbuf[chan_len+1]); chan_len += 2; chan->att = from_bcd_be(chanbuf+chan_len++,2); --- 1091,1096 ---- chan_len = 4+freq_len+1; ! icom2hamlib_mode(chanbuf[chan_len] | chanbuf[chan_len+1], ! &chan->mode, &width); chan_len += 2; chan->att = from_bcd_be(chanbuf+chan_len++,2); *************** *** 1280,1283 **** --- 1282,1286 ---- freq_t freq; rmode_t mode; + pbwidth_t width; rig_debug(RIG_DEBUG_VERBOSE, "icom: icom_decode called\n"); *************** *** 1306,1311 **** case C_SND_MODE: if (rig->callbacks.mode_event) { ! mode = icom2hamlib_mode(buf[5]| buf[6]<<8); ! return rig->callbacks.mode_event(rig,mode); } else return -RIG_ENAVAIL; --- 1309,1314 ---- case C_SND_MODE: if (rig->callbacks.mode_event) { ! icom2hamlib_mode(buf[5]| buf[6]<<8, &mode, &width); ! return rig->callbacks.mode_event(rig,mode,width); } else return -RIG_ENAVAIL; Index: icom.h =================================================================== RCS file: /cvsroot/hamlib/hamlib/icom/icom.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** icom.h 2000/10/29 16:26:23 1.8 --- icom.h 2000/12/04 23:39:17 1.9 *************** *** 45,50 **** int icom_set_freq(RIG *rig, freq_t freq); int icom_get_freq(RIG *rig, freq_t *freq); ! int icom_set_mode(RIG *rig, rmode_t mode); ! int icom_get_mode(RIG *rig, rmode_t *mode); int icom_set_vfo(RIG *rig, vfo_t vfo); int icom_set_rptr_shift(RIG *rig, rptr_shift_t rptr_shift); --- 45,50 ---- int icom_set_freq(RIG *rig, freq_t freq); int icom_get_freq(RIG *rig, freq_t *freq); ! int icom_set_mode(RIG *rig, rmode_t mode, pbwidth_t width); ! int icom_get_mode(RIG *rig, rmode_t *mode, pbwidth_t *width); int icom_set_vfo(RIG *rig, vfo_t vfo); int icom_set_rptr_shift(RIG *rig, rptr_shift_t rptr_shift); |