// File: /workspace/github_cpp_makefile_star2_O1/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 0xa0f53
cmpl $0xd, %edi
je 0xa0f53
cmpl $0xa, %edi
jne 0xa0f2c
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2cbd26(%rip), %rdi    # 0x36cb40
callq 0x9899
movl $0x1, %ebx
movl $0x1, %edi
callq 0xa0567
testl %eax, %eax
jne 0xa0f27
leaq 0x2cbd03(%rip), %rdi    # 0x36cb40
leaq 0x847fb(%rip), %rsi     # 0x12563f
callq 0x9090
movb $0xa, %r14b
testq %rax, %rax
jne 0xa0edd
leaq 0x2cbce4(%rip), %rdi    # 0x36cb40
leaq 0x847e5(%rip), %rsi     # 0x125648
callq 0x9090
movl $0x2, %ebx
testq %rax, %rax
jne 0xa0edd
leaq 0x2cbcc7(%rip), %rdi    # 0x36cb40
leaq 0x87e85(%rip), %rsi     # 0x128d05
callq 0x9090
movl $0x3, %ebx
movb $0x1a, %r14b
testq %rax, %rax
jne 0xa0edd
leaq 0x2cbca7(%rip), %rdi    # 0x36cb40
leaq 0x86eaf(%rip), %rsi     # 0x127d4f
callq 0x9090
testq %rax, %rax
jne 0xa0eda
leaq 0x2cbc8f(%rip), %rdi    # 0x36cb40
leaq 0x84797(%rip), %rsi     # 0x12564f
callq 0x9090
testq %rax, %rax
jne 0xa0eda
leaq 0x2cbc77(%rip), %rdi    # 0x36cb40
leaq 0x84579(%rip), %rsi     # 0x125449
callq 0x9090
testq %rax, %rax
je 0xa0ef0
xorl %r14d, %r14d
leaq 0x26c5b3(%rip), %rax    # 0x30d497
movb %r14b, (%rax)
leaq 0x17a12a(%rip), %rax    # 0x21b018
movl %ebx, (%rax)
leaq 0x2cbc49(%rip), %rdi    # 0x36cb40
leaq 0x84688(%rip), %rsi     # 0x125586
callq 0x9090
testq %rax, %rax
je 0xa0f54
cmpl $0x2, 0x2cf0d5(%rip)    # 0x36ffe4
jne 0xa0f16
callq 0x9f964
movl $0x0, 0x2cbca4(%rip)    # 0x36cbc4
movb $0x0, 0x2cbc19(%rip)    # 0x36cb40
popq %rbx
popq %r14
popq %rbp
retq
movslq 0x2cbc91(%rip), %rax    # 0x36cbc4
cmpq $0x7e, %rax
jg 0xa0f53
leaq 0x1(%rax), %rcx
movl %ecx, 0x2cbc81(%rip)    # 0x36cbc4
leaq 0x2cbbf6(%rip), %rcx    # 0x36cb40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2cbbe5(%rip), %rdi    # 0x36cb40
leaq 0x7ce98(%rip), %rsi     # 0x11ddfa
callq 0x9090
testq %rax, %rax
je 0xa0fd1
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26bcd1(%rip), %rcx    # 0x30cc50
movl %eax, (%rcx)
leaq 0x26bccc(%rip), %rax    # 0x30cc54
movl $0x3, (%rax)
leaq 0x2cbbab(%rip), %rdi    # 0x36cb40
leaq 0x7ce63(%rip), %rsi     # 0x11ddff
callq 0x9090
testq %rax, %rax
je 0xa0f08
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26bc9b(%rip), %rcx    # 0x30cc58
movl %eax, (%rcx)
leaq 0x26bc96(%rip), %rax    # 0x30cc5c
movl $0x3, (%rax)
jmp 0xa0f08
leaq 0x2cbb68(%rip), %rdi    # 0x36cb40
leaq 0x84677(%rip), %rsi     # 0x125656
callq 0x9090
testq %rax, %rax
jne 0xa1001
leaq 0x2cbb50(%rip), %rdi    # 0x36cb40
leaq 0x84666(%rip), %rsi     # 0x12565d
callq 0x9090
testq %rax, %rax
je 0xa101a
movl $0x1, 0x2cefdd(%rip)    # 0x36ffe8
leaq 0x26c0be(%rip), %rax    # 0x30d0d0
movb $0x9, (%rax)
jmp 0xa0f08
leaq 0x2cbb1f(%rip), %rdi    # 0x36cb40
leaq 0x92057(%rip), %rsi     # 0x13307f
callq 0x9090
testq %rax, %rax
je 0xa10b8
leaq 0x2cbb03(%rip), %rdi    # 0x36cb40
leaq 0x68f58(%rip), %rsi     # 0x109f9c
callq 0x9090
testq %rax, %rax
je 0xa10b8
leaq 0x2cbaeb(%rip), %rdi    # 0x36cb40
leaq 0x922ee(%rip), %rsi     # 0x13334a
callq 0x9090
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
leaq 0x179fac(%rip), %rax    # 0x21b01c
movl %ecx, (%rax)
movl $0x2, 0x2cef68(%rip)    # 0x36ffe4
leaq 0x17784d(%rip), %rax    # 0x2188d0
cmpq $0x8, (%rax)
jne 0xa0f08
movl $0x218, %eax            # imm = 0x218
leaq 0x19df17(%rip), %rcx    # 0x23efb0
xorl %edx, %edx
movl %edx, (%rcx,%rax)
movl %edx, -0x1fc(%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd358, %rax          # imm = 0xCD358
jne 0xa109b
jmp 0xa0f08
leaq 0x2cba81(%rip), %rdi    # 0x36cb40
leaq 0x84414(%rip), %rsi     # 0x1254da
callq 0x9090
testq %rax, %rax
je 0xa11a2
leaq 0x2cba65(%rip), %rdi    # 0x36cb40
leaq 0x81d3e(%rip), %rsi     # 0x122e20
callq 0x9090
testq %rax, %rax
je 0xa11a2
movl $0x4, 0x2ceeea(%rip)    # 0x36ffe4
leaq 0x26c217(%rip), %rax    # 0x30d318
movl $0x2c, (%rax)
movl 0x2d0dc7(%rip), %edi    # 0x371ed4
addl 0x2d0dbd(%rip), %edi    # 0x371ed0
leaq 0x19ddf2(%rip), %rax    # 0x23ef0c
movl %edi, (%rax)
callq 0x5e411
leaq 0x2cba18(%rip), %rdi    # 0x36cb40
leaq 0x8453b(%rip), %rsi     # 0x12566a
callq 0x9090
testq %rax, %rax
je 0xa115d
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26c90c(%rip), %rax    # 0x30da58
movsd %xmm0, (%rax)
leaq 0x26c919(%rip), %rax    # 0x30da70
movl $0x1, (%rax)
leaq 0x2cb9dc(%rip), %rdi    # 0x36cb40
leaq 0x84502(%rip), %rsi     # 0x12566d
callq 0x9090
testq %rax, %rax
je 0xa0f08
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26c8dc(%rip), %rax    # 0x30da68
movsd %xmm0, (%rax)
leaq 0x26c8e1(%rip), %rax    # 0x30da78
movl $0x1, (%rax)
jmp 0xa0f08
cmpl $0x4, 0x2cee3b(%rip)    # 0x36ffe4
jne 0xa0f08
leaq 0x2cb98a(%rip), %rdi    # 0x36cb40
leaq 0x69c29(%rip), %rsi     # 0x10ade6
callq 0x9090
testq %rax, %rax
je 0xa0f08
movl $0x0, 0x2cee0f(%rip)    # 0x36ffe4
jmp 0xa0f08