#define CONTOUR_USB_VENDOR_ID 0x1a79
#define CONTOUR_USB_PRODUCT_ID 0x6002
+#define MAX_MSGS 103
+
struct msg {
int direction;
unsigned char data[64];
int send_msg(const struct msg *msg, int fd, int usage_code)
{
int ret;
+ static int msg_count;
if (msg->direction != OUT) {
trace(0, "Message direction is not OUT\n");
exit(1);
}
+ if (trace_level < 1 && msg_count <= MAX_MSGS) {
+ trace(0, "\r%d%%", msg_count * 100 / MAX_MSGS);
+ fflush(stdout);
+ }
usleep(30 * 1000);
trace(1, "Sending: ");
if (ret)
exit(1);
+ msg_count++;
return 0;
}
int i, j;
struct msg msg, in;
msg.direction = OUT;
+ trace(0, "Initializing..\n");
read_msgs(fd);
SET_FIRST_BYTE(0x01);
send_msg(&msg, fd, uc);
read_msgs(fd);
- trace(0, "Glucose readings:\n");
+ trace(0, "\nGlucose readings:\n");
usleep(100 * 1000);
do {
send_msg(&msg, fd, uc);