// File: /workspace/github_cpp_makefile_star2_O3/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 0xa1168
cmpl $0xd, %edi
je 0xa1168
cmpl $0xa, %edi
jne 0xa1141
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2cbb13(%rip), %rdi    # 0x36cb40
callq 0x9899
movl $0x1, %ebx
movl $0x1, %edi
callq 0xa0779
testl %eax, %eax
jne 0xa113c
leaq 0x2cbaf0(%rip), %rdi    # 0x36cb40
leaq 0x846c8(%rip), %rsi     # 0x12571f
callq 0x9090
movb $0xa, %r14b
testq %rax, %rax
jne 0xa10f0
leaq 0x2cbad1(%rip), %rdi    # 0x36cb40
leaq 0x846b2(%rip), %rsi     # 0x125728
callq 0x9090
movl $0x2, %ebx
testq %rax, %rax
jne 0xa10f0
leaq 0x2cbab4(%rip), %rdi    # 0x36cb40
leaq 0x87d3d(%rip), %rsi     # 0x128dd0
callq 0x9090
movl $0x3, %ebx
movb $0x1a, %r14b
testq %rax, %rax
jne 0xa10f0
leaq 0x2cba94(%rip), %rdi    # 0x36cb40
leaq 0x86d67(%rip), %rsi     # 0x127e1a
callq 0x9090
testq %rax, %rax
jne 0xa10ed
leaq 0x2cba7c(%rip), %rdi    # 0x36cb40
leaq 0x84664(%rip), %rsi     # 0x12572f
callq 0x9090
testq %rax, %rax
jne 0xa10ed
leaq 0x2cba64(%rip), %rdi    # 0x36cb40
leaq 0x84446(%rip), %rsi     # 0x125529
callq 0x9090
testq %rax, %rax
je 0xa1103
xorl %r14d, %r14d
leaq 0x26c3a0(%rip), %rax    # 0x30d497
movb %r14b, (%rax)
leaq 0x179f17(%rip), %rax    # 0x21b018
movl %ebx, (%rax)
leaq 0x2cba36(%rip), %rdi    # 0x36cb40
leaq 0x84555(%rip), %rsi     # 0x125666
callq 0x9090
testq %rax, %rax
je 0xa1169
movl 0x2ceec3(%rip), %eax    # 0x36ffe4
cmpl $0x2, %eax
jne 0xa112b
callq 0x9fb68
movl $0x0, 0x2cba8f(%rip)    # 0x36cbc4
movb $0x0, 0x2cba04(%rip)    # 0x36cb40
popq %rbx
popq %r14
popq %rbp
retq
movslq 0x2cba7c(%rip), %rax    # 0x36cbc4
cmpq $0x7e, %rax
jg 0xa1168
leaq 0x1(%rax), %rcx
movl %ecx, 0x2cba6c(%rip)    # 0x36cbc4
leaq 0x2cb9e1(%rip), %rcx    # 0x36cb40
movb %dil, (%rax,%rcx)
movb $0x0, 0x1(%rax,%rcx)
retq
leaq 0x2cb9d0(%rip), %rdi    # 0x36cb40
leaq 0x7cd17(%rip), %rsi     # 0x11de8e
callq 0x9090
testq %rax, %rax
je 0xa11e6
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26babc(%rip), %rcx    # 0x30cc50
movl %eax, (%rcx)
leaq 0x26bab7(%rip), %rax    # 0x30cc54
movl $0x3, (%rax)
leaq 0x2cb996(%rip), %rdi    # 0x36cb40
leaq 0x7cce2(%rip), %rsi     # 0x11de93
callq 0x9090
testq %rax, %rax
je 0xa111b
addq $0x4, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26ba86(%rip), %rcx    # 0x30cc58
movl %eax, (%rcx)
leaq 0x26ba81(%rip), %rax    # 0x30cc5c
movl $0x3, (%rax)
jmp 0xa111b
leaq 0x2cb953(%rip), %rdi    # 0x36cb40
leaq 0x84542(%rip), %rsi     # 0x125736
callq 0x9090
testq %rax, %rax
jne 0xa1216
leaq 0x2cb93b(%rip), %rdi    # 0x36cb40
leaq 0x84531(%rip), %rsi     # 0x12573d
callq 0x9090
testq %rax, %rax
je 0xa122f
movl $0x1, 0x2cedc8(%rip)    # 0x36ffe8
leaq 0x26bea9(%rip), %rax    # 0x30d0d0
movb $0x9, (%rax)
jmp 0xa111b
leaq 0x2cb90a(%rip), %rdi    # 0x36cb40
leaq 0x91f32(%rip), %rsi     # 0x13316f
callq 0x9090
testq %rax, %rax
je 0xa12cd
leaq 0x2cb8ee(%rip), %rdi    # 0x36cb40
leaq 0x68d53(%rip), %rsi     # 0x109fac
callq 0x9090
testq %rax, %rax
je 0xa12cd
leaq 0x2cb8d6(%rip), %rdi    # 0x36cb40
leaq 0x921c9(%rip), %rsi     # 0x13343a
callq 0x9090
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
leaq 0x179d97(%rip), %rax    # 0x21b01c
movl %ecx, (%rax)
movl $0x2, 0x2ced53(%rip)    # 0x36ffe4
leaq 0x177638(%rip), %rax    # 0x2188d0
cmpq $0x8, (%rax)
jne 0xa1126
movl $0x218, %eax            # imm = 0x218
leaq 0x19dd02(%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 0xa12b0
jmp 0xa111b
leaq 0x2cb86c(%rip), %rdi    # 0x36cb40
leaq 0x842df(%rip), %rsi     # 0x1255ba
callq 0x9090
testq %rax, %rax
je 0xa13b7
leaq 0x2cb850(%rip), %rdi    # 0x36cb40
leaq 0x81c09(%rip), %rsi     # 0x122f00
callq 0x9090
testq %rax, %rax
je 0xa13b7
movl $0x4, 0x2cecd5(%rip)    # 0x36ffe4
leaq 0x26c002(%rip), %rax    # 0x30d318
movl $0x2c, (%rax)
movl 0x2d0bb2(%rip), %edi    # 0x371ed4
addl 0x2d0ba8(%rip), %edi    # 0x371ed0
leaq 0x19dbdd(%rip), %rax    # 0x23ef0c
movl %edi, (%rax)
callq 0x5e390
leaq 0x2cb803(%rip), %rdi    # 0x36cb40
leaq 0x84406(%rip), %rsi     # 0x12574a
callq 0x9090
testq %rax, %rax
je 0xa1372
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26c6f7(%rip), %rax    # 0x30da58
movsd %xmm0, (%rax)
leaq 0x26c704(%rip), %rax    # 0x30da70
movl $0x1, (%rax)
leaq 0x2cb7c7(%rip), %rdi    # 0x36cb40
leaq 0x843cd(%rip), %rsi     # 0x12574d
callq 0x9090
testq %rax, %rax
je 0xa111b
addq $0x2, %rax
movq %rax, %rdi
callq 0x9470
leaq 0x26c6c7(%rip), %rax    # 0x30da68
movsd %xmm0, (%rax)
leaq 0x26c6cc(%rip), %rax    # 0x30da78
movl $0x1, (%rax)
jmp 0xa111b
movl 0x2cec27(%rip), %eax    # 0x36ffe4
cmpl $0x4, %eax
jne 0xa1121
leaq 0x2cb773(%rip), %rdi    # 0x36cb40
leaq 0x69a22(%rip), %rsi     # 0x10adf6
callq 0x9090
testq %rax, %rax
je 0xa112b
movl $0x0, 0x2cebf8(%rip)    # 0x36ffe4
jmp 0xa112b