Update the code to use the new datetime support.

This commit is contained in:
Jef Driesen 2010-02-01 21:20:11 +00:00
parent 54410dab8d
commit b392a49045
7 changed files with 19 additions and 24 deletions

View File

@ -23,6 +23,7 @@
#define DEVICE_H
#include "buffer.h"
#include "datetime.h"
#ifdef __cplusplus
extern "C" {

View File

@ -22,7 +22,6 @@
#include <string.h> // memcmp, memcpy
#include <stdlib.h> // malloc, free
#include <assert.h> // assert
#include <time.h> // time
#include "device-private.h"
#include "reefnet_sensus.h"
@ -43,7 +42,7 @@ typedef struct reefnet_sensus_device_t {
unsigned int waiting;
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} reefnet_sensus_device_t;
static device_status_t reefnet_sensus_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
@ -110,7 +109,7 @@ reefnet_sensus_device_open (device_t **out, const char* name)
device->port = NULL;
device->waiting = 0;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
memset (device->handshake, 0, sizeof (device->handshake));
@ -272,7 +271,7 @@ reefnet_sensus_handshake (reefnet_sensus_device_t *device)
#endif
// Store the clock calibration values.
device->systime = time (NULL);
device->systime = dc_datetime_now ();
device->devtime = array_uint32_le (handshake + 8);
// Store the handshake packet.

View File

@ -21,7 +21,6 @@
#include <string.h> // memcmp, memcpy
#include <stdlib.h> // malloc, free
#include <time.h> // time
#include "device-private.h"
#include "reefnet_sensuspro.h"
@ -41,7 +40,7 @@ typedef struct reefnet_sensuspro_device_t {
unsigned char handshake[REEFNET_SENSUSPRO_HANDSHAKE_SIZE];
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} reefnet_sensuspro_device_t;
static device_status_t reefnet_sensuspro_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
@ -89,7 +88,7 @@ reefnet_sensuspro_device_open (device_t **out, const char* name)
// Set the default values.
device->port = NULL;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
memset (device->handshake, 0, sizeof (device->handshake));
@ -241,7 +240,7 @@ reefnet_sensuspro_handshake (reefnet_sensuspro_device_t *device)
#endif
// Store the clock calibration values.
device->systime = time (NULL);
device->systime = dc_datetime_now ();
device->devtime = array_uint32_le (handshake + 6);
// Store the handshake packet.

View File

@ -22,7 +22,6 @@
#include <string.h> // memcmp, memcpy
#include <stdlib.h> // malloc, free
#include <assert.h> // assert
#include <time.h> // time
#include "device-private.h"
#include "reefnet_sensusultra.h"
@ -47,7 +46,7 @@ typedef struct reefnet_sensusultra_device_t {
unsigned int maxretries;
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} reefnet_sensusultra_device_t;
static device_status_t reefnet_sensusultra_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
@ -96,7 +95,7 @@ reefnet_sensusultra_device_open (device_t **out, const char* name)
device->port = NULL;
device->maxretries = 2;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
memset (device->handshake, 0, sizeof (device->handshake));
@ -346,7 +345,7 @@ reefnet_sensusultra_handshake (reefnet_sensusultra_device_t *device)
#endif
// Store the clock calibration values.
device->systime = time (NULL);
device->systime = dc_datetime_now ();
device->devtime = array_uint32_le (handshake + 4);
// Store the handshake packet.

View File

@ -21,7 +21,6 @@
#include <stdlib.h> // malloc, free
#include <memory.h> // memcpy
#include <time.h> // time
#include <assert.h> // assert
#include "device-private.h"
@ -49,7 +48,7 @@ typedef struct uwatec_aladin_device_t {
struct serial *port;
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} uwatec_aladin_device_t ;
static device_status_t uwatec_aladin_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
@ -97,7 +96,7 @@ uwatec_aladin_device_open (device_t **out, const char* name)
// Set the default values.
device->port = NULL;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
// Open the device.
@ -233,7 +232,7 @@ uwatec_aladin_device_dump (device_t *abstract, dc_buffer_t *buffer)
}
// Fetch the current system time.
time_t now = time (NULL);
dc_ticks_t now = dc_datetime_now ();
// Update and emit a progress event.
progress.current += 4;

View File

@ -22,7 +22,6 @@
#include <string.h> // memcmp, memcpy
#include <stdlib.h> // malloc, free
#include <assert.h> // assert
#include <time.h> // time
#include "device-private.h"
#include "uwatec_memomouse.h"
@ -46,7 +45,7 @@ typedef struct uwatec_memomouse_device_t {
struct serial *port;
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} uwatec_memomouse_device_t;
static device_status_t uwatec_memomouse_device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size);
@ -94,7 +93,7 @@ uwatec_memomouse_device_open (device_t **out, const char* name)
// Set the default values.
device->port = NULL;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
// Open the device.
@ -427,7 +426,7 @@ uwatec_memomouse_dump_internal (uwatec_memomouse_device_t *device, dc_buffer_t *
}
// Fetch the current system time.
time_t now = time (NULL);
dc_ticks_t now = dc_datetime_now ();
// Read the data packet.
rc = uwatec_memomouse_read_packet_inner (device, buffer, &progress);

View File

@ -21,7 +21,6 @@
#include <stdlib.h> // malloc, free
#include <string.h> // strncmp, strstr
#include <time.h> // time, strftime
#include "device-private.h"
#include "uwatec_smart.h"
@ -40,7 +39,7 @@ typedef struct uwatec_smart_device_t {
unsigned int address;
unsigned int timestamp;
unsigned int devtime;
time_t systime;
dc_ticks_t systime;
} uwatec_smart_device_t;
static device_status_t uwatec_smart_device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size);
@ -167,7 +166,7 @@ uwatec_smart_device_open (device_t **out)
device->socket = NULL;
device->address = 0;
device->timestamp = 0;
device->systime = (time_t) -1;
device->systime = (dc_ticks_t) -1;
device->devtime = 0;
irda_init ();
@ -335,7 +334,7 @@ uwatec_smart_device_dump (device_t *abstract, dc_buffer_t *buffer)
return rc;
// Store the clock calibration values.
device->systime = time (NULL);
device->systime = dc_datetime_now ();
device->devtime = array_uint32_le (version + 5);
// Update and emit a progress event.