thermferm/server.c

changeset 125
94aea38d4da5
parent 124
350401bac16e
child 131
528dc0bb81ab
equal deleted inserted replaced
124:350401bac16e 125:94aea38d4da5
233 if (de->d_name[0] != '.') { 233 if (de->d_name[0] != '.') {
234 ref = 0; 234 ref = 0;
235 if (strncmp(de->d_name, (char *)"w1", 2) == 0) { 235 if (strncmp(de->d_name, (char *)"w1", 2) == 0) {
236 srv_send((char *)"%s,0,NA,System device", de->d_name); 236 srv_send((char *)"%s,0,NA,System device", de->d_name);
237 } else if (strncmp(de->d_name, (char *)"10", 2) == 0) { 237 } else if (strncmp(de->d_name, (char *)"10", 2) == 0) {
238 if (Config.air_address && (strncmp((char *)"10", Config.air_address, 2) == 0)) 238 if (Config.air_address && (strcmp(de->d_name, Config.air_address) == 0))
239 ref++; 239 ref++;
240 for (unit = Config.units; unit; unit = unit->next) { 240 for (unit = Config.units; unit; unit = unit->next) {
241 if (unit->air_address && (strncmp((char *)"10", unit->air_address, 2) == 0)) 241 if (unit->air_address && (strcmp(de->d_name, unit->air_address) == 0))
242 ref++; 242 ref++;
243 if (unit->beer_address && (strncmp((char *)"10", unit->beer_address, 2) == 0)) 243 if (unit->beer_address && (strcmp(de->d_name, unit->beer_address) == 0))
244 ref++; 244 ref++;
245 } 245 }
246 srv_send((char *)"%s,%d,18S20,Digital thermometer", ref, de->d_name); 246 srv_send((char *)"%s,%d,18S20,Digital thermometer", de->d_name, ref);
247 } else if (strncmp(de->d_name, (char *)"28", 2) == 0) { 247 } else if (strncmp(de->d_name, (char *)"28", 2) == 0) {
248 if (Config.air_address && (strncmp((char *)"28", Config.air_address, 2) == 0)) 248 if (Config.air_address && (strcmp(de->d_name, Config.air_address) == 0))
249 ref++; 249 ref++;
250 for (unit = Config.units; unit; unit = unit->next) { 250 for (unit = Config.units; unit; unit = unit->next) {
251 if (unit->air_address && (strncmp((char *)"28", unit->air_address, 2) == 0)) 251 if (unit->air_address && (strcmp(de->d_name, unit->air_address) == 0))
252 ref++; 252 ref++;
253 if (unit->beer_address && (strncmp((char *)"28", unit->beer_address, 2) == 0)) 253 if (unit->beer_address && (strcmp(de->d_name, unit->beer_address) == 0))
254 ref++; 254 ref++;
255 } 255 }
256 srv_send((char *)"%s,%d,18B20,Digital thermometer", ref, de->d_name); 256 srv_send((char *)"%s,%d,18B20,Digital thermometer", de->d_name, ref);
257 } else if (strncmp(de->d_name, (char *)"29", 2) == 0) { 257 } else if (strncmp(de->d_name, (char *)"29", 2) == 0) {
258 for (unit = Config.units; unit; unit = unit->next) { 258 for (unit = Config.units; unit; unit = unit->next) {
259 if (unit->io1_address && (strncmp((char *)"29", unit->io1_address, 2) == 0)) 259 if (unit->io1_address && (strncmp((char *)"29", unit->io1_address, 2) == 0))
260 ref++; 260 ref++;
261 if (unit->io2_address && (strncmp((char *)"29", unit->io2_address, 2) == 0)) 261 if (unit->io2_address && (strncmp((char *)"29", unit->io2_address, 2) == 0))
262 ref++; 262 ref++;
263 } 263 }
264 srv_send((char *)"%s,%d,2408,8 Channel addressable switch/LCD", ref, de->d_name); 264 srv_send((char *)"%s,%d,2408,8 Channel addressable switch/LCD", de->d_name, ref);
265 } else if (strncmp(de->d_name, (char *)"3a", 2) == 0) { 265 } else if (strncmp(de->d_name, (char *)"3a", 2) == 0) {
266 for (unit = Config.units; unit; unit = unit->next) { 266 for (unit = Config.units; unit; unit = unit->next) {
267 if (unit->io1_address && (strncmp((char *)"3a", unit->io1_address, 2) == 0)) 267 if (unit->io1_address && (strncmp((char *)"3a", unit->io1_address, 2) == 0))
268 ref++; 268 ref++;
269 if (unit->io2_address && (strncmp((char *)"3a", unit->io2_address, 2) == 0)) 269 if (unit->io2_address && (strncmp((char *)"3a", unit->io2_address, 2) == 0))
270 ref++; 270 ref++;
271 } 271 }
272 srv_send((char *)"%s,%d,2413,Dual channel addressable switchs", ref, de->d_name); 272 srv_send((char *)"%s,%d,2413,Dual channel addressable switchs", de->d_name, ref);
273 } else { 273 } else {
274 srv_send((char *)"%s,0,NA,Unknown device", de->d_name); 274 srv_send((char *)"%s,0,NA,Unknown device", de->d_name);
275 } 275 }
276 } 276 }
277 } 277 }

mercurial