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

Function set_chan

tests/memload.c:117–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116#ifdef HAVE_XML2
117int set_chan(RIG *rig, channel_t *chan, xmlNodePtr node)
118{
119 xmlChar *prop;
120 int i, n;
121 struct rig_state *rs = STATE(rig);
122
123 memset(chan, 0, sizeof(channel_t));
124 chan->vfo = RIG_VFO_MEM;
125
126
127 prop = xmlGetProp(node, (unsigned char *) "num");
128
129 if (prop == NULL)
130 {
131 fprintf(stderr, "no num\n");
132 return -1;
133 }
134
135 n = chan->channel_num = atoi((char *) prop);
136
137 /* find channel caps */
138 for (i = 0; i < HAMLIB_CHANLSTSIZ ; i++)
139 {
140 if (rs->chan_list[i].startc <= n
141 && rs->chan_list[i].endc >= n)
142 {
143
144 break;
145 }
146 }
147
148 if (i == HAMLIB_CHANLSTSIZ) { return -RIG_EINVAL; }
149
150 fprintf(stderr, "node %d %d\n", n, i);
151
152 if (rs->chan_list[i].mem_caps.bank_num)
153 {
154 prop = xmlGetProp(node, (unsigned char *) "bank_num");
155
156 if (prop != NULL)
157 {
158 chan->bank_num = atoi((char *) prop);
159 }
160 }
161
162 if (rs->chan_list[i].mem_caps.channel_desc)
163 {
164 prop = xmlGetProp(node, (unsigned char *) "channel_desc");
165
166 if (prop != NULL)
167 {
168 strncpy(chan->channel_desc, (char *) prop, 7);
169 }
170 }
171
172 if (rs->chan_list[i].mem_caps.ant)
173 {
174 prop = xmlGetProp(node, (unsigned char *) "ant");

Callers 1

xml_loadFunction · 0.85

Calls 1

rig_parse_modeFunction · 0.85

Tested by

no test coverage detected