Example #1
0
void print_frame(int len) {
    int i;
    int byte;
    //int err = 0;

    printf("\n");
    for (i = 0; i < len; i++) {
        byte = bits2byte(bitframe+10*i+2);
        frame[i] = byte;
        //printf("%02X ", byte);
    }

    if (option_raw) {
        for (i = 0; i < len; i++) {
            fprintf(stdout, "%02x ", frame[i]);
        }
        fprintf(stdout, "\n");
    }
    //else
    {
        if ((frame[0] == 0x01) && (frame[1] == 0x02)) { // GPS Data Packet
            print_gps(0x00);  // packet offset in frame
            fprintf(stdout, "\n");
        }
    }

}
Example #2
0
int main(int argc, char *argv[]){

#ifdef GPS_CONNECTED 
    (void)printf("Starting up\n");
    serPort = open(serialPortFilename, O_RDWR | O_NOCTTY);
    (void)printf("Open GPS  port %s result %d\n", serialPortFilename, serPort);
    if( serPort == -1 )
    {
        (void)printf("GPS Not Connected");
    }
    else
    {
    	tcgetattr(serPort, &options);

	    cfsetispeed(&options, B57600);

	    cfsetospeed(&options, B57600);

	    options.c_cflag |= (CLOCAL |CREAD);

	    tcsetattr(serPort, TCSANOW, &options);

	    (void)printf("Connected to GPS\n");

	while(1){
		print_gps();
		
	}
    }
#endif
}