- if(!strncmp(buffer->buf, "Temp ", 5)) {
- SEND_TO_LISTENER(temp_listener, "", cmd_fd, buffer->buf);
+ if(!strncmp(buffer->buf, "Sensor ", 7)) {
+ if (buffer->buf[7] != 0)
+ {
+ char const *sampledev_key;
+ if (asprintf(sampledev_key, "%c",buffer->buf[7]))
+ {
+ char const *sampledev_name = key_value_storage_find_first_stringvalue(&(opt->sampledevs_), sampledev_key);
+ if(sampledev_name)
+ {
+ char const *rev_lookuped_output;
+ if (asprintf(rev_lookuped_output, "%s%s", sampledev_name, &(buffer->buf[8])))
+ {
+ SEND_TO_LISTENER(sensor_listener, "", cmd_fd, rev_lookuped_output);
+ free((void*) rev_lookuped_output);
+ }
+ }
+ else
+ {
+ log_printf(WARNING, "unknown sample device key '%s' encountered", sampledev_key);
+ SEND_TO_LISTENER(sensor_listener, "", cmd_fd, buffer->buf);
+ }
+ free((void*) sampledev_key);
+ }
+ }