Changeset 112

Show
Ignore:
Timestamp:
05/14/07 20:31:15 (2 years ago)
Author:
dsmith
Message:

added timestamp to message interfaces

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r101 r112  
     12007-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 
    1142007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    215        libcwiid 
  • trunk/libcwiid/connect.c

    r101 r112  
    9090        /* If BDADDR_ANY is given, find available wiimote */ 
    9191        if (bacmp(bdaddr, BDADDR_ANY) == 0) { 
    92                 if (cwiid_find_wiimote(bdaddr, 2)) { 
     92                if (cwiid_find_wiimote(bdaddr, 5)) { 
    9393                        goto ERR_HND; 
    9494                } 
  • trunk/libcwiid/cwiid.h

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to message functions 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * rewrite for API overhaul 
     
    4851#include <stdarg.h> 
    4952#include <stdint.h> 
     53#include <time.h> 
    5054#include <bluetooth/bluetooth.h>        /* bdaddr_t */ 
    5155 
     
    267271 
    268272typedef void cwiid_mesg_callback_t(cwiid_wiimote_t *, int, 
    269                                    union cwiid_mesg []); 
     273                                   union cwiid_mesg [], struct timespec *); 
    270274typedef void cwiid_err_t(cwiid_wiimote_t *, const char *, va_list ap); 
    271275 
     
    301305                       cwiid_mesg_callback_t *callback); 
    302306int cwiid_get_mesg(cwiid_wiimote_t *wiimote, int *mesg_count, 
    303                    union cwiid_mesg *mesg[]); 
     307                   union cwiid_mesg *mesg[], struct timespec *timestamp); 
    304308int cwiid_get_state(cwiid_wiimote_t *wiimote, struct cwiid_state *state); 
    305309 
  • trunk/libcwiid/cwiid_internal.h

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to mesg_array 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * rewrite for API overhaul 
     
    143146struct mesg_array { 
    144147        uint8_t count; 
     148        struct timespec timestamp; 
    145149        union cwiid_mesg array[CWIID_MAX_MESG_COUNT]; 
    146150}; 
  • trunk/libcwiid/interface.c

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to cwiid_get_mesg 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * created for API overhaul 
     
    9497 
    9598int cwiid_get_mesg(struct wiimote *wiimote, int *mesg_count, 
    96                    union cwiid_mesg *mesg[]
     99                   union cwiid_mesg *mesg[], struct timespec *timestamp
    97100{ 
    98101        struct mesg_array ma; 
     
    109112 
    110113        *mesg_count = ma.count; 
     114        *timestamp = ma.timestamp; 
    111115 
    112116        if ((*mesg = malloc(ma.count * sizeof ma.array[0])) == NULL) { 
  • trunk/libcwiid/thread.c

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to message array 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * rewrite for API overhaul (renamed from event.c) 
     
    5053#include <string.h> 
    5154#include <pthread.h> 
     55#include <time.h> 
    5256#include <unistd.h> 
    5357#include "cwiid_internal.h" 
     
    5963        ssize_t len; 
    6064        struct mesg_array ma; 
    61         char err
     65        char err, print_clock_err = 1
    6266 
    6367        while (1) { 
     
    7579                        } 
    7680                        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                        } 
    7787                        err = 0; 
    7888 
     
    251261                        cwiid_err(wiimote, "Cancel state disable error (callback thread)"); 
    252262                } 
    253                 callback(wiimote, ma.count, ma.array); 
     263                callback(wiimote, ma.count, ma.array, &ma.timestamp); 
    254264                if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &cancelstate)) { 
    255265                        cwiid_err(wiimote, "Cancel state restore error (callback thread)"); 
  • trunk/libcwiid/util.c

    r101 r112  
    214214        ssize_t len; 
    215215 
    216         /* there may be padding after ma->count */ 
    217216        len = (void *)&ma->array[0] - (void *)ma; 
    218217        if (full_read(fd, ma, len)) { 
  • trunk/wmdemo/wmdemo.c

    r101 r112  
    287287 * */ 
    288288void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 
    289                     union cwiid_mesg mesg[]
     289                    union cwiid_mesg mesg[], struct timespec *timestamp
    290290{ 
    291291        int i, j; 
  • trunk/wmgui/main.c

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to message callback 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * updated for API overhaul 
     
    10171020#define BATTERY_STR_LEN 14      /* "Battery: 100%" + '\0' */ 
    10181021void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 
    1019                     union cwiid_mesg mesg_array[]
     1022                    union cwiid_mesg mesg_array[], struct timespec *timestamp
    10201023{ 
    10211024        int i; 
  • trunk/wminput/main.c

    r101 r112  
    1616 * 
    1717 *  ChangeLog: 
     18 *  2007-05-14 L. Donnie Smith <cwiid@abstrakraft.org> 
     19 *  * added timestamp to message callback 
     20 * 
    1821 *  2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> 
    1922 *  * update for API overhaul 
     
    267270 
    268271void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, 
    269                     union cwiid_mesg mesg[]
     272                    union cwiid_mesg mesg[], struct timespec *timestamp
    270273{ 
    271274        int i;