// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_uccm_status(unsigned char)
void get_uccm_status(u08 c)
{
char *s;

   // get values from SYST:STAT message response
   if(c == 0x0D) return;   // samsung
   if(c == 0x00) return;

   if(c == 0x0A) {  // end-of-line,  process it
      strupr(scpi_status_line);
      if(uccm_time_line(1)) return;  // time code message in middle of the status message

      if(strstr(scpi_status_line, "SETTLING")) {
         discipline_mode = DIS_MODE_WARMUP;
         saw_uccm_dmode = 1;
      }
      else if(strstr(scpi_status_line, "WARMUP")) {
         discipline_mode = DIS_MODE_WARMUP;
         saw_uccm_dmode = 2;
      }
      else if(strstr(scpi_status_line, "UNLOCK")) {
         discipline_mode = DIS_MODE_UNLOCK;
         saw_uccm_dmode = 3;
      }
      else if(strstr(scpi_status_line, "LOCK")) {
         discipline_mode = DIS_MODE_NORMAL;
         saw_uccm_dmode = 3;
      }
      else if(strstr(scpi_status_line, "NORMAL")) {
         discipline_mode = DIS_MODE_NORMAL;
         saw_uccm_dmode = 3;
      }
      else if(strstr(scpi_status_line, "SURVEY")) {
         discipline_mode = DIS_MODE_NORMAL;
         saw_uccm_dmode = 3;
      }

      if(strstr(scpi_status_line, "COMMAND COMPLETE")) {
//       scpi_status = 0;
      }
      else if(strstr(scpi_status_line, "TFOM")) {
         s = strstr(scpi_status_line, "TFOM");
         if(s) {
            tfom = atoi(s+4);
            have_tfom = 3;
         }
         s = strstr(scpi_status_line, "FFOM");
         if(s) {
            ffom = atoi(s+4);
            have_ffom = 3;
         }
      }
      else if(strstr(scpi_status_line, "NO REF")) {
         no_uccm_ref = 1;
         rcvr_mode = RCVR_MODE_ACQUIRE;  // !!!! RCVR_MODE_NO_SATS
      }
      else if(strstr(scpi_status_line, "WAIT FOR GPS")) {
         no_uccm_ref = 1;
         rcvr_mode = RCVR_MODE_ACQUIRE;
      }
      else if(strstr(scpi_status_line, "PRN") && strstr(scpi_status_line, "EL")) {  // tracking info follows
         if(strstr(scpi_status_line, "SS")) adjust_scpi_ss = 1;
         else                               adjust_scpi_ss = 0;
         scpi_status = 2;
         if(rcvr_type == UCCM_RCVR) {
            reset_sat_tracking();
         }
      }
      else if(strstr(scpi_status_line, "ELEV") && strstr(scpi_status_line, "MASK")) {  // end of tracking info
         scpi_status = 4; // skip lines until we see the COMMAND COMPLETE
         have_count = 44;
         sat_count = scpi_tracked + scpi_not_tracked;
         config_sat_count(sat_count);
         s = strstr(scpi_status_line, "V=");
         if(s) {
            ant_v1 = atof(s+2);
            have_ant_v1 = 1;
         }
         s = strstr(scpi_status_line, "I=");
         if(s) {
            ant_ma = atof(s+2);
            have_ant_ma = 1;
         }
      }
      else if((scpi_status == 4) && strstr(scpi_status_line, "------")) {
         scpi_status = 0;
      }
      if(scpi_status == 2) {  // we are in the az/el area, decode it
         parse_scpi_azel();
      }

      scpi_col = 0;
      scpi_status_line[0] = 0;
   }
   else {  // accumulate the status line
      if(scpi_col < ((int)sizeof(scpi_status_line)-2)) {
         scpi_status_line[scpi_col++] = c;
         scpi_status_line[scpi_col] = 0;
      }
// if(debug_file) fprintf(debug_file, "sline col:%d c:%d: stat:%d [%s]\n", scpi_col, c, scpi_status, scpi_status_line);
   }
}

// Assembly:
testl %edi, %edi
je 0x91f46
cmpl $0xd, %edi
je 0x91f46
cmpl $0xa, %edi
jne 0x91f1f
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2c4c77(%rip), %rdi    # 0x356b40
callq 0x988f
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x916e0
testl %eax, %eax
jne 0x91ff9
leaq 0x2c4c59(%rip), %rdi    # 0x356b40
leaq 0x7d779(%rip), %rsi     # 0x10f667
callq 0x9090
movb $0xa, %r14b
testq %rax, %rax
jne 0x91fb0
leaq 0x2c4c3a(%rip), %rdi    # 0x356b40
leaq 0x7d763(%rip), %rsi     # 0x10f670
callq 0x9090
testq %rax, %rax
je 0x91f47
pushq $0x2
popq %rbx
jmp 0x91fb0
movslq 0x2c4c9e(%rip), %rax    # 0x356bc4
cmpq $0x7e, %rax
jg 0x91f46
leaq 0x1(%rax), %rcx
movl %ecx, 0x2c4c8e(%rip)    # 0x356bc4
leaq 0x2c4c03(%rip), %rcx    # 0x356b40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2c4bf2(%rip), %rdi    # 0x356b40
leaq 0x80dc0(%rip), %rsi     # 0x112d15
callq 0x9090
pushq $0x3
popq %rbx
movb $0x1a, %r14b
testq %rax, %rax
jne 0x91fb0
leaq 0x2c4bd4(%rip), %rdi    # 0x356b40
leaq 0x7fdec(%rip), %rsi     # 0x111d5f
callq 0x9090
testq %rax, %rax
jne 0x91fad
leaq 0x2c4bbc(%rip), %rdi    # 0x356b40
leaq 0x7d6ec(%rip), %rsi     # 0x10f677
callq 0x9090
testq %rax, %rax
jne 0x91fad
leaq 0x2c4ba4(%rip), %rdi    # 0x356b40
leaq 0x7d4ce(%rip), %rsi     # 0x10f471
callq 0x9090
testq %rax, %rax
je 0x91fc3
xorl %r14d, %r14d
leaq 0x2654e0(%rip), %rax    # 0x2f7497
movb %r14b, (%rax)
leaq 0x173057(%rip), %rax    # 0x205018
movl %ebx, (%rax)
leaq 0x2c4b76(%rip), %rdi    # 0x356b40
leaq 0x7d5dd(%rip), %rsi     # 0x10f5ae
callq 0x9090
testq %rax, %rax
je 0x91ffe
movl 0x2c8003(%rip), %eax    # 0x359fe4
cmpl $0x2, %eax
jne 0x91feb
callq 0x90b85
andl $0x0, 0x2c4bd2(%rip)    # 0x356bc4
movb $0x0, 0x2c4b47(%rip)    # 0x356b40
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2c4b3b(%rip), %rdi    # 0x356b40
leaq 0x75f02(%rip), %rsi     # 0x107f0e
callq 0x9090
testq %rax, %rax
je 0x92077
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x264c27(%rip), %rcx    # 0x2f6c50
movl %eax, (%rcx)
leaq 0x264c22(%rip), %rax    # 0x2f6c54
movl $0x3, (%rax)
leaq 0x2c4b01(%rip), %rdi    # 0x356b40
leaq 0x75ecd(%rip), %rsi     # 0x107f13
callq 0x9090
testq %rax, %rax
je 0x91fdb
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x264bf5(%rip), %rcx    # 0x2f6c58
movl %eax, (%rcx)
leaq 0x264bf0(%rip), %rax    # 0x2f6c5c
movl $0x3, (%rax)
jmp 0x91fdb
leaq 0x2c4ac2(%rip), %rdi    # 0x356b40
leaq 0x7d5f9(%rip), %rsi     # 0x10f67e
callq 0x9090
testq %rax, %rax
jne 0x920a7
leaq 0x2c4aaa(%rip), %rdi    # 0x356b40
leaq 0x7d5e8(%rip), %rsi     # 0x10f685
callq 0x9090
testq %rax, %rax
je 0x920c0
movl $0x1, 0x2c7f37(%rip)    # 0x359fe8
leaq 0x265018(%rip), %rax    # 0x2f70d0
movb $0x9, (%rax)
jmp 0x91fdb
leaq 0x2c4a79(%rip), %rdi    # 0x356b40
leaq 0x8afc1(%rip), %rsi     # 0x11d08f
callq 0x9090
testq %rax, %rax
je 0x92139
leaq 0x2c4a61(%rip), %rdi    # 0x356b40
leaq 0x61f16(%rip), %rsi     # 0xf3ffc
callq 0x9090
testq %rax, %rax
je 0x92139
leaq 0x2c4a49(%rip), %rdi    # 0x356b40
leaq 0x8b25c(%rip), %rsi     # 0x11d35a
callq 0x9090
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
leaq 0x172f0a(%rip), %rax    # 0x20501c
movl %ecx, (%rax)
movl $0x2, 0x2c7ec6(%rip)    # 0x359fe4
leaq 0x1707ab(%rip), %rax    # 0x2028d0
cmpq $0x8, (%rax)
jne 0x91fe6
callq 0x56b1c
jmp 0x91fdb
leaq 0x2c4a00(%rip), %rdi    # 0x356b40
leaq 0x7d3bb(%rip), %rsi     # 0x10f502
callq 0x9090
testq %rax, %rax
je 0x92223
leaq 0x2c49e4(%rip), %rdi    # 0x356b40
leaq 0x7ace5(%rip), %rsi     # 0x10ce48
callq 0x9090
testq %rax, %rax
je 0x92223
movl $0x4, 0x2c7e69(%rip)    # 0x359fe4
leaq 0x265196(%rip), %rax    # 0x2f7318
movl $0x2c, (%rax)
movl 0x2c9d46(%rip), %edi    # 0x35bed4
addl 0x2c9d3c(%rip), %edi    # 0x35bed0
leaq 0x196d71(%rip), %rax    # 0x228f0c
movl %edi, (%rax)
callq 0x56d93
leaq 0x2c4997(%rip), %rdi    # 0x356b40
leaq 0x7d4e2(%rip), %rsi     # 0x10f692
callq 0x9090
testq %rax, %rax
je 0x921de
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26588b(%rip), %rax    # 0x2f7a58
movsd %xmm0, (%rax)
leaq 0x265898(%rip), %rax    # 0x2f7a70
movl $0x1, (%rax)
leaq 0x2c495b(%rip), %rdi    # 0x356b40
leaq 0x7d4a9(%rip), %rsi     # 0x10f695
callq 0x9090
testq %rax, %rax
je 0x91fdb
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26585b(%rip), %rax    # 0x2f7a68
movsd %xmm0, (%rax)
leaq 0x265860(%rip), %rax    # 0x2f7a78
movl $0x1, (%rax)
jmp 0x91fdb
movl 0x2c7dbb(%rip), %eax    # 0x359fe4
cmpl $0x4, %eax
jne 0x91fe1
leaq 0x2c4907(%rip), %rdi    # 0x356b40
leaq 0x62c31(%rip), %rsi     # 0xf4e71
callq 0x9090
testq %rax, %rax
je 0x91feb
andl $0x0, 0x2c7d8f(%rip)    # 0x359fe4
jmp 0x91feb