| 115 | |
| 116 | #ifdef HAVE_XML2 |
| 117 | int 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"); |
no test coverage detected