Changeset 112
- Timestamp:
- 05/14/07 20:31:15 (2 years ago)
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libcwiid/connect.c (modified) (1 diff)
- trunk/libcwiid/cwiid.h (modified) (4 diffs)
- trunk/libcwiid/cwiid_internal.h (modified) (2 diffs)
- trunk/libcwiid/interface.c (modified) (3 diffs)
- trunk/libcwiid/thread.c (modified) (5 diffs)
- trunk/libcwiid/util.c (modified) (1 diff)
- trunk/wmdemo/wmdemo.c (modified) (1 diff)
- trunk/wmgui/main.c (modified) (2 diffs)
- trunk/wminput/main.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r101 r112 1 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 2 libcwiid 3 * added timestamp to message interfaces 4 5 wmdemo 6 * updated for timestamp addition 7 8 wmgui 9 * updated for timestamp addition 10 11 wminput 12 * updated for timestamp addition 13 1 14 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 2 15 libcwiid trunk/libcwiid/connect.c
r101 r112 90 90 /* If BDADDR_ANY is given, find available wiimote */ 91 91 if (bacmp(bdaddr, BDADDR_ANY) == 0) { 92 if (cwiid_find_wiimote(bdaddr, 2)) {92 if (cwiid_find_wiimote(bdaddr, 5)) { 93 93 goto ERR_HND; 94 94 } trunk/libcwiid/cwiid.h
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to message functions 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * rewrite for API overhaul … … 48 51 #include <stdarg.h> 49 52 #include <stdint.h> 53 #include <time.h> 50 54 #include <bluetooth/bluetooth.h> /* bdaddr_t */ 51 55 … … 267 271 268 272 typedef void cwiid_mesg_callback_t(cwiid_wiimote_t *, int, 269 union cwiid_mesg [] );273 union cwiid_mesg [], struct timespec *); 270 274 typedef void cwiid_err_t(cwiid_wiimote_t *, const char *, va_list ap); 271 275 … … 301 305 cwiid_mesg_callback_t *callback); 302 306 int cwiid_get_mesg(cwiid_wiimote_t *wiimote, int *mesg_count, 303 union cwiid_mesg *mesg[] );307 union cwiid_mesg *mesg[], struct timespec *timestamp); 304 308 int cwiid_get_state(cwiid_wiimote_t *wiimote, struct cwiid_state *state); 305 309 trunk/libcwiid/cwiid_internal.h
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to mesg_array 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * rewrite for API overhaul … … 143 146 struct mesg_array { 144 147 uint8_t count; 148 struct timespec timestamp; 145 149 union cwiid_mesg array[CWIID_MAX_MESG_COUNT]; 146 150 }; trunk/libcwiid/interface.c
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to cwiid_get_mesg 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * created for API overhaul … … 94 97 95 98 int cwiid_get_mesg(struct wiimote *wiimote, int *mesg_count, 96 union cwiid_mesg *mesg[] )99 union cwiid_mesg *mesg[], struct timespec *timestamp) 97 100 { 98 101 struct mesg_array ma; … … 109 112 110 113 *mesg_count = ma.count; 114 *timestamp = ma.timestamp; 111 115 112 116 if ((*mesg = malloc(ma.count * sizeof ma.array[0])) == NULL) { trunk/libcwiid/thread.c
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to message array 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * rewrite for API overhaul (renamed from event.c) … … 50 53 #include <string.h> 51 54 #include <pthread.h> 55 #include <time.h> 52 56 #include <unistd.h> 53 57 #include "cwiid_internal.h" … … 59 63 ssize_t len; 60 64 struct mesg_array ma; 61 char err ;65 char err, print_clock_err = 1; 62 66 63 67 while (1) { … … 75 79 } 76 80 ma.count = 0; 81 if (clock_gettime(CLOCK_REALTIME, &ma.timestamp)) { 82 if (print_clock_err) { 83 cwiid_err(wiimote, "clock_gettime error"); 84 print_clock_err = 0; 85 } 86 } 77 87 err = 0; 78 88 … … 251 261 cwiid_err(wiimote, "Cancel state disable error (callback thread)"); 252 262 } 253 callback(wiimote, ma.count, ma.array );263 callback(wiimote, ma.count, ma.array, &ma.timestamp); 254 264 if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &cancelstate)) { 255 265 cwiid_err(wiimote, "Cancel state restore error (callback thread)"); trunk/libcwiid/util.c
r101 r112 214 214 ssize_t len; 215 215 216 /* there may be padding after ma->count */217 216 len = (void *)&ma->array[0] - (void *)ma; 218 217 if (full_read(fd, ma, len)) { trunk/wmdemo/wmdemo.c
r101 r112 287 287 * */ 288 288 void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 289 union cwiid_mesg mesg[] )289 union cwiid_mesg mesg[], struct timespec *timestamp) 290 290 { 291 291 int i, j; trunk/wmgui/main.c
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to message callback 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * updated for API overhaul … … 1017 1020 #define BATTERY_STR_LEN 14 /* "Battery: 100%" + '\0' */ 1018 1021 void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 1019 union cwiid_mesg mesg_array[] )1022 union cwiid_mesg mesg_array[], struct timespec *timestamp) 1020 1023 { 1021 1024 int i; trunk/wminput/main.c
r101 r112 16 16 * 17 17 * ChangeLog: 18 * 2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 19 * * added timestamp to message callback 20 * 18 21 * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 19 22 * * update for API overhaul … … 267 270 268 271 void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 269 union cwiid_mesg mesg[] )272 union cwiid_mesg mesg[], struct timespec *timestamp) 270 273 { 271 274 int i;
