MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / rig_poll_routine

Function rig_poll_routine

src/event.c:64–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62} rig_poll_routine_priv_data;
63
64void *rig_poll_routine(void *arg)
65{
66 rig_poll_routine_args *args = (rig_poll_routine_args *)arg;
67 RIG *rig = args->rig;
68 struct rig_state *rs = STATE(rig);
69 struct rig_cache *cachep = CACHE(rig);
70 int update_occurred;
71
72 vfo_t vfo = RIG_VFO_NONE, tx_vfo = RIG_VFO_NONE;
73 freq_t freq_main_a = 0, freq_main_b = 0, freq_main_c = 0, freq_sub_a = 0,
74 freq_sub_b = 0, freq_sub_c = 0;
75 rmode_t mode_main_a = 0, mode_main_b = 0, mode_main_c = 0, mode_sub_a = 0,
76 mode_sub_b = 0, mode_sub_c = 0;
77 pbwidth_t width_main_a = 0, width_main_b = 0, width_main_c = 0, width_sub_a = 0,
78 width_sub_b = 0, width_sub_c = 0;
79 ptt_t ptt = RIG_PTT_OFF;
80 split_t split = RIG_SPLIT_OFF;
81
82 rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Starting rig poll routine thread\n",
83 __FILE__, __LINE__);
84
85 // Rig cache time should be equal to rig poll interval (should be set automatically by rigctld at least)
86 rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_ALL, rs->poll_interval);
87
88 // Attempt to detect changes with the interval below (in milliseconds)
89 int change_detection_interval = 50;
90 int interval_count = 0;
91
92 update_occurred = 0;
93
94 network_publish_rig_poll_data(rig);
95
96 while (rs->poll_routine_thread_run)
97 {
98 if (rs->current_vfo != vfo)
99 {
100 vfo = rs->current_vfo;
101 update_occurred = 1;
102 }
103
104 if (rs->tx_vfo != tx_vfo)
105 {
106 tx_vfo = rs->tx_vfo;
107 update_occurred = 1;
108 }
109
110 if (cachep->freqMainA != freq_main_a)
111 {
112 freq_main_a = cachep->freqMainA;
113 update_occurred = 1;
114 }
115
116 if (cachep->freqMainB != freq_main_b)
117 {
118 freq_main_b = cachep->freqMainB;
119 update_occurred = 1;
120 }
121

Callers

nothing calls this directly

Calls 4

rig_debugFunction · 0.85
rig_set_cache_timeout_msFunction · 0.85
hl_usleepFunction · 0.85

Tested by

no test coverage detected