diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-05-20 19:13:35 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-05-20 19:13:35 +0000 |
commit | 3b7496d15320746c2f8e7abb5554a837ac70c95b (patch) | |
tree | c360165f24229b00678fee14fd2cbc0d0532ea86 /libgpsmm.h | |
parent | a1a63fb9ffb0911822ba09224f9e0703c5dc820b (diff) | |
download | gpsd-3b7496d15320746c2f8e7abb5554a837ac70c95b.tar.gz |
Somehow this didn't get checked in before.
Diffstat (limited to 'libgpsmm.h')
-rw-r--r-- | libgpsmm.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libgpsmm.h b/libgpsmm.h new file mode 100644 index 00000000..d41404b8 --- /dev/null +++ b/libgpsmm.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2005 Alfredo Pironti + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef _GPSMM_H_ +#define _GPSMM_H_ + +#include "gps.h" //the C library we are going to wrap + +class gpsmm { + public: + gpsmm() { }; + virtual ~gpsmm(); + struct gps_data_t* open(const char *host,const char *port); //opens the connection with gpsd, MUST call this before any other method + struct gps_data_t* open(void); //open() with default values + struct gps_data_t* query(const char *request); //put a command to gpsd and return the updated struct + struct gps_data_t* poll(void); //block until gpsd returns new data, then return the updated struct + int set_callback(void (*hook)(struct gps_data_t *sentence, char *buf)); //set a callback funcition, called each time new data arrives + int del_callback(void); //delete the callback function + void clear_fix(void); + + private: + struct gps_data_t *gps_data; + struct gps_data_t *to_user; //we return the user a copy of the internal structure. This way she can modify it without + //integrity loss for the entire class + struct gps_data_t* backup(void) { *to_user=*gps_data; return to_user;}; //return the backup copy + pthread_t *handler; //needed to handle the callback registration/deletion +}; +#endif // _GPSMM_H_ |