From: Alexandru C. <cs...@us...> - 2004-06-18 14:16:46
|
Update of /cvsroot/groundstation/grig2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11187 Modified Files: rig-daemon.c rig-daemon.h Log Message: Added default RX and TX cycles definitions. Index: rig-daemon.c =================================================================== RCS file: /cvsroot/groundstation/grig2/src/rig-daemon.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rig-daemon.c 17 Jun 2004 17:39:04 -0000 1.3 --- rig-daemon.c 18 Jun 2004 14:16:35 -0000 1.4 *************** *** 36,39 **** --- 36,43 ---- * * This object manages the connection to the hamradio control libraries. + * After initialization of the radio it start a cyclic thread which will + * execute some pre-defined commands. Because some manufacturers discourage + * agressive polling while in TX mode, the daemon will only acquire very + * few things while in this mode. */ *************** *** 50,60 **** - RIG *myrig = NULL; /*!< The rig structure. */ - extern GConfClient *confclient; /*!< Shared GConfClient. */ /* private function prototypes */ static void rig_daemon_post_init (void); --- 54,97 ---- RIG *myrig = NULL; /*!< The rig structure. */ extern GConfClient *confclient; /*!< Shared GConfClient. */ + /** \brief Matrix defining the default RX cycle. + * + * More description of the idea. + * + */ + static const rig_cmd_t DEF_RX_CYCLE[C_MAX_CYCLES][C_MAX_CMD_PER_CYCLE] = { + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_FREQ_1, RIG_CMD_GET_FREQ_1, RIG_CMD_GET_PSTAT, RIG_CMD_SET_PSTAT }, + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_FREQ_2, RIG_CMD_GET_FREQ_2, RIG_CMD_SET_RIT, RIG_CMD_GET_RIT }, + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_FREQ_1, RIG_CMD_GET_FREQ_1, RIG_CMD_SET_RIT, RIG_CMD_GET_RIT }, + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_FREQ_2, RIG_CMD_GET_FREQ_2, RIG_CMD_SET_XIT, RIG_CMD_GET_XIT }, + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_FREQ_1, RIG_CMD_GET_FREQ_1, RIG_CMD_SET_MODE, RIG_CMD_GET_MODE }, + { RIG_CMD_GET_STRENGTH, RIG_CMD_SET_VFO, RIG_CMD_GET_VFO, RIG_CMD_SET_PTT, RIG_CMD_GET_PTT } + }; + + + + /** \brief MAtrix defining the default TX cycle. + * + * More description. + * + * \note Some radios do not like being polled while in TX mode so + * we make TX cycle easy... + * + */ + static const rig_cmd_t DEF_TX_CYCLE[C_MAX_CYCLES][C_MAX_CMD_PER_CYCLE] = { + { RIG_CMD_SET_PTT, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE }, + { RIG_CMD_GET_PTT, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE }, + { RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE }, + { RIG_CMD_SET_PTT, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE }, + { RIG_CMD_GET_PTT, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE }, + { RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE, RIG_CMD_NONE } + }; + + + /* private function prototypes */ static void rig_daemon_post_init (void); *************** *** 140,143 **** --- 177,184 ---- /* send stop signal to daemon process */ + + /* wait 100 msec */ + + /* close radio device */ rig_close (myrig); Index: rig-daemon.h =================================================================== RCS file: /cvsroot/groundstation/grig2/src/rig-daemon.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rig-daemon.h 17 Jun 2004 17:39:05 -0000 1.4 --- rig-daemon.h 18 Jun 2004 14:16:35 -0000 1.5 *************** *** 37,40 **** --- 37,48 ---- + #define C_MAX_CMD_PER_CYCLE 5 /*!< Max number of commands executed in one cycle */ + #define C_MAX_CYCLES 6 /*!< Number of cycles */ + + #define C_RX_CYCLE_DELAY 30 /*!< Delay between two RX cycles in milliseconds */ + #define C_TX_CYCLE_DELAY 300 /*!< Delay between two TX cycles in milliseconds */ + + + /** \brief List of available commands. * *************** *** 45,69 **** RIG_CMD_NONE = 0, /*!< Not command. Used to end a sequence of commands. */ ! RIG_CMD_GET_FREQ_1, /*!< Command to acquire primary frequency from rig. */ ! RIG_CMD_SET_FREQ_1, /*!< Command to set primary frequency. */ ! RIG_CMD_GET_FREQ_2, /*!< Command to acquire secondary frequency from rig. */ ! RIG_CMD_SET_FREQ_2, /*!< Command to set secondary frequency. */ ! RIG_CMD_GET_RIT, /*!< Command to get current RIT value. */ ! RIG_CMD_SET_RIT, /*!< Command to set new RIT value. */ ! RIG_CMD_GET_XIT, /*!< Command to get current XIT value. */ ! RIG_CMD_SET_XIT, /*!< Command to set new XIT value. */ ! RIG_CMD_GET_VFO, /*!< Command to get currently active VFO. */ ! RIG_CMD_SET_VFO, /*!< Command to select new VFO. */ ! RIG_CMD_GET_PSTAT, /*!< Command to read power status (mains pwr, ON/OFF/STDBY). */ ! RIG_CMD_SET_PSTAT, /*!< Command to set new power status (ON/OFF/STDBY). */ ! RIG_CMD_GET_PTT, /*!< Command to get the current PTT status. */ ! RIG_CMD_SET_PTT, /*!< Command to set the current PTT status. */ ! RIG_CMD_GET_MODE, /*!< Command to get the current mode and pass band width. */ ! RIG_CMD_SET_MODE, /*!< Command to set the new mode and/or pass band width. */ ! RIG_CMD_NUMBER /*!< Number of available commands. */ } rig_cmd_t; int rig_daemon_start (int); void rig_daemon_stop (void); --- 53,81 ---- RIG_CMD_NONE = 0, /*!< Not command. Used to end a sequence of commands. */ ! RIG_CMD_GET_FREQ_1, /*!< Command to acquire primary frequency from rig. */ ! RIG_CMD_SET_FREQ_1, /*!< Command to set primary frequency. */ ! RIG_CMD_GET_FREQ_2, /*!< Command to acquire secondary frequency from rig. */ ! RIG_CMD_SET_FREQ_2, /*!< Command to set secondary frequency. */ ! RIG_CMD_GET_RIT, /*!< Command to get current RIT value. */ ! RIG_CMD_SET_RIT, /*!< Command to set new RIT value. */ ! RIG_CMD_GET_XIT, /*!< Command to get current XIT value. */ ! RIG_CMD_SET_XIT, /*!< Command to set new XIT value. */ ! RIG_CMD_GET_VFO, /*!< Command to get currently active VFO. */ ! RIG_CMD_SET_VFO, /*!< Command to select new VFO. */ ! RIG_CMD_GET_PSTAT, /*!< Command to read power status (mains pwr, ON/OFF/STDBY). */ ! RIG_CMD_SET_PSTAT, /*!< Command to set new power status (ON/OFF/STDBY). */ ! RIG_CMD_GET_PTT, /*!< Command to get the current PTT status. */ ! RIG_CMD_SET_PTT, /*!< Command to set the current PTT status. */ ! RIG_CMD_GET_MODE, /*!< Command to get the current mode and pass band width. */ ! RIG_CMD_SET_MODE, /*!< Command to set the new mode and/or pass band width. */ ! RIG_CMD_GET_STRENGTH, /*!< Command to get signal strength. */ ! RIG_CMD_GET_PWR, /*!< ... */ ! ! RIG_CMD_NUMBER /*!< Number of available commands. */ } rig_cmd_t; + int rig_daemon_start (int); void rig_daemon_stop (void); |