User's Manual
13 / 13
www.asiatelco.com
GPS Interface
//i2ccmd i fd
int open_fd(void)
{
char nm[16];
int fd;
snprintf(nm, 16, "/dev/%s", I2C_DEV_NAME);
if ((fd = open(nm, O_RDONLY)) < 0) {
perror(nm);
exit(fd);
}
return fd;
}
int ValGetNmeaData (unsigned char * data)
{
int fd = -1;
fd = open_fd();
if (fd < 0)
{
return -1;
}
if (ioctl(fd, RT2880_I2C_READ_GPS_DATA, data) < 0)
{
perror("ioctl");
close(fd);
return -1;
}
close(fd);
return 0;
}
Data: input array[] for get data. The max size is 2048.
Example:
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The end, thanks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014/03