From d73860aa0723724aa86640c099a8e5a925865c93 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 14 Mar 2010 18:38:00 +0000 Subject: [PATCH 1/1] changed temp/photo listener to sensor listener --- powersensordaemon/client_list.c | 3 +-- powersensordaemon/client_list.h | 3 +-- powersensordaemon/powersensordaemon.c | 22 +++++++--------------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/powersensordaemon/client_list.c b/powersensordaemon/client_list.c index f136f8e..5a79cd8 100644 --- a/powersensordaemon/client_list.c +++ b/powersensordaemon/client_list.c @@ -48,8 +48,7 @@ int client_add(client_t** first, int fd) new_client->fd = fd; new_client->request_listener = 0; new_client->error_listener = 0; - new_client->temp_listener = 0; - new_client->photo_listener = 0; + new_client->sensor_listener = 0; new_client->movement_listener = 0; new_client->button_listener = 0; new_client->next = NULL; diff --git a/powersensordaemon/client_list.h b/powersensordaemon/client_list.h index 2ff9a90..9237688 100644 --- a/powersensordaemon/client_list.h +++ b/powersensordaemon/client_list.h @@ -28,8 +28,7 @@ struct client_struct { int fd; int request_listener; int error_listener; - int temp_listener; - int photo_listener; + int sensor_listener; int movement_listener; int button_listener; struct client_struct* next; diff --git a/powersensordaemon/powersensordaemon.c b/powersensordaemon/powersensordaemon.c index 0a94676..8b12743 100644 --- a/powersensordaemon/powersensordaemon.c +++ b/powersensordaemon/powersensordaemon.c @@ -263,16 +263,14 @@ int process_cmd(char* cmd, int fd, cmd_t **cmd_q, client_t* client_lst, options_ if(!param || !strncmp(param, "all", 3)) { listener->request_listener = 1; listener->error_listener = 1; - listener->temp_listener = 1; - listener->photo_listener = 1; + listener->sensor_listener = 1; listener->movement_listener = 1; listener->button_listener = 1; } else if(!strncmp(param, "none", 4)) { listener->request_listener = 0; listener->error_listener = 0; - listener->temp_listener = 0; - listener->photo_listener = 0; + listener->sensor_listener = 0; listener->movement_listener = 0; listener->button_listener = 0; } @@ -280,10 +278,8 @@ int process_cmd(char* cmd, int fd, cmd_t **cmd_q, client_t* client_lst, options_ listener->request_listener = 1; else if(!strncmp(param, "error", 5)) listener->error_listener = 1; - else if(!strncmp(param, "temp", 4)) - listener->temp_listener = 1; - else if(!strncmp(param, "photo", 5)) - listener->photo_listener = 1; + else if(!strncmp(param, "sensor", 6)) + listener->sensor_listener = 1; else if(!strncmp(param, "movement", 8)) listener->movement_listener = 1; else if(!strncmp(param, "button", 6)) @@ -385,12 +381,8 @@ int process_tty(read_buffer_t* buffer, int tty_fd, cmd_t **cmd_q, client_t* clie SEND_TO_LISTENER(button_listener, "panic button", cmd_fd, buffer->buf); } - if(!strncmp(buffer->buf, "Temp ", 5)) { - SEND_TO_LISTENER(temp_listener, "", cmd_fd, buffer->buf); - } - - if(!strncmp(buffer->buf, "Photo: ", 5)) { - SEND_TO_LISTENER(photo_listener, "", cmd_fd, buffer->buf); + if(!strncmp(buffer->buf, "Sensor ", 7)) { + SEND_TO_LISTENER(sensor_listener, "", cmd_fd, buffer->buf); } cmd_pop(cmd_q); @@ -531,7 +523,7 @@ int main_loop(int tty_fd, int cmd_listen_fd, autosample_process_t* autosample, o lst = client_lst; int listener_cnt = 0; while(lst) { - if(lst->temp_listener || lst->photo_listener) + if(lst->sensor_listener) listener_cnt++; lst = lst->next; } -- 1.7.10.4