소스 검색

auxiliary function to setup FONA GPS. not used but there if needed

Abram Connelly 6 년 전
부모
커밋
bfc2c2bf2e
1개의 변경된 파일27개의 추가작업 그리고 6개의 파일을 삭제
  1. 27 6
      busunit/gps/gps_main.c

+ 27 - 6
busunit/gps/gps_main.c

@@ -483,11 +483,38 @@ void maintain_ipc_hub_connect(char *progname) {
   }
 }
 
+// This might be better done at a higher level but kept here
+// in case we need it.
+//
+int reset_gps() {
+  char msg_gps_off[] = "AT+CGPS=0\n",
+       msg_gps_on[] = "AT+CGPS=1\n",
+       msg_gps_poll_off[] = "AT+CGPSINFOCFG=0\n",
+       msg_gps_poll_on[] = "AT+CGPSINFOCFG=3,31\n";
+  size_t n;
+
+  if (gps_fd < 0) { return -1; }
+
+  n = stlren(msg_gps_off)+1;
+  write(gps_fd, msg_gps_off, n);
+
+  n = stlren(msg_gps_poll_off)+1;
+  write(gps_fd, msg_gps_poll_off, n);
 
+  n = stlren(msg_gps_on)+1;
+  write(gps_fd, msg_gps_on, n);
+
+  n = stlren(msg_gps_poll_on)+1;
+  write(gps_fd, msg_gps_poll_on, n);
+
+  return 0;
+}
 
 //----------------------------------
 
 int main(int argc, char **argv) {
+  int i;
+
   char line[LINE_BUFFER_SIZE] = {0};
 
   struct message_record incoming_msg;
@@ -499,15 +526,9 @@ int main(int argc, char **argv) {
   int poll_return;
   int read_return;
 
-  int i;
-
   time_t now;
-
-  //int retval = 0;
-
   time_t last_stale_gps_check = 0;
 
-
   // Configure our signal handlers to deal with SIGINT, SIGTERM, etc... 
   // and make graceful exits while logging
   //