| 81 | |
| 82 | #ifdef HAVE_XML2 |
| 83 | int dump_xml_chan(RIG *rig, |
| 84 | vfo_t vfo, |
| 85 | channel_t **chan_pp, |
| 86 | int chan_num, |
| 87 | const chan_t *chan_list, |
| 88 | rig_ptr_t arg) |
| 89 | { |
| 90 | char attrbuf[20]; |
| 91 | xmlNodePtr root = arg; |
| 92 | xmlNodePtr node = NULL; |
| 93 | int i; |
| 94 | const char *mtype; |
| 95 | |
| 96 | static channel_t chan; |
| 97 | const channel_cap_t *mem_caps = &chan_list->mem_caps; |
| 98 | |
| 99 | |
| 100 | if (*chan_pp == NULL) |
| 101 | { |
| 102 | /* |
| 103 | * Hamlib frontend demand application an allocated |
| 104 | * channel_t pointer for next round. |
| 105 | */ |
| 106 | *chan_pp = &chan; |
| 107 | |
| 108 | return RIG_OK; |
| 109 | } |
| 110 | |
| 111 | if (chan_list->type == RIG_MTYPE_NONE) |
| 112 | { |
| 113 | return RIG_OK; |
| 114 | } |
| 115 | |
| 116 | mtype = rig_strmtype(chan_list->type); |
| 117 | |
| 118 | for (i = 0; i < strlen(mtype); i++) |
| 119 | { |
| 120 | attrbuf[i] = tolower(mtype[i]); |
| 121 | } |
| 122 | |
| 123 | attrbuf[i] = '\0'; |
| 124 | |
| 125 | node = xmlNewChild(root, NULL, (unsigned char *)attrbuf, NULL); |
| 126 | |
| 127 | if (mem_caps->bank_num) |
| 128 | { |
| 129 | SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.bank_num); |
| 130 | xmlNewProp(node, (unsigned char *) "bank_num", (unsigned char *) attrbuf); |
| 131 | } |
| 132 | |
| 133 | SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.channel_num); |
| 134 | xmlNewProp(node, (unsigned char *) "num", (unsigned char *) attrbuf); |
| 135 | |
| 136 | if (mem_caps->channel_desc && chan.channel_desc[0] != '\0') |
| 137 | { |
| 138 | xmlNewProp(node, |
| 139 | (unsigned char *) "channel_desc", |
| 140 | (unsigned char *) chan.channel_desc); |
nothing calls this directly
no test coverage detected