]> pilppa.com Git - libplpdevicebus.git/commitdiff
use read interval seconds param when polling data
authorMika Laitio <lamikr@pilppa.org>
Tue, 24 Jul 2012 01:41:15 +0000 (04:41 +0300)
committerMika Laitio <lamikr@pilppa.org>
Tue, 24 Jul 2012 01:41:15 +0000 (04:41 +0300)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src_server/DeviceManagerServer.cc

index 53b5a4916a0a9ca830c74b55768e0ae59b96714f..8257561467635217230f9bace4fb1436d4f2d44e 100644 (file)
@@ -25,7 +25,11 @@ static void *device_data_reader_thread(void *thread_args_pointer) {
        list<Device *>::iterator        list_iter;
        Device                          *device;
        SensorDevice                    *sensor;
+       long                            read_int_sec;
 
+       read_int_sec    = DeviceConfig::get_read_interval_seconds();
+       if (read_int_sec < 0)
+               read_int_sec = 600;
        _dev_lst        = (list<Device *> *)thread_args_pointer;
        while(1) {
                for (list_iter = _dev_lst->begin(); list_iter != _dev_lst->end(); list_iter++) {
@@ -33,9 +37,9 @@ static void *device_data_reader_thread(void *thread_args_pointer) {
                        sensor = dynamic_cast<SensorDevice *>(device);
                        if (sensor != NULL) {
                                sensor->get_data();
-                               sleep(60);
                        }
                }
+               sleep(read_int_sec);
        }
        pthread_exit(NULL);
 }