// File: /workspace/github_c_makefile_star2_O2/connycommy[P]atCmdDevice/src/atcmdDev/atCmdDevice.c
// Function: cmIsrRx
void cmIsrRx(cmData_t *obj, const char rxChar){

	/* misra c 15.5*/
	if( (rxChar < (char)CHAR_PRINT_BELOW)  || (rxChar > (char)CHAR_PRINT_ABOVE) ) {
		return ;  /*Char no print*/
	}

	if(1 == obj->rxData.readyAsyncEvent){
		obj->rxData.bufferAsyncEvent[obj->rxData.indexAsyncEvent++] = rxChar;
		if(obj->rxData.indexAsyncEvent > CM_BUFFER_LEN_DEF ){
			obj->rxData.indexAsyncEvent = 0;
		}
		obj->rxData.bufferAsyncEvent[obj->rxData.indexAsyncEvent] = 0;

		if(rxChar == '\n'){
			 obj->rxData.readyAsyncEvent = 0;
			 obj->rxData.asyncEvent=1;
			 obj->rxData.countAsyncEvent++;
		}
	}else{
		obj->rxData.readyAsyncEvent = findStrCharByChar("URC",rxChar);
	}

	/*misra c 15.6,14.4 , 15.6*/
	if( 1 == obj->rxData.ready) {
		return; /* B_uffer reveived*/
	}
	 obj->rxData.buffer[obj->rxData.index] = rxChar; /*misra c 13.3*/
	obj->rxData.index++;

	if (obj->rxData.index >= (obj->rxData.len - (uint8_t)1) ) { /* misra c 10.4*/
		obj->rxData.index = 0; 
	}
	 obj->rxData.buffer[obj->rxData.index] = (char)0;

	#ifdef _USE_STRSTR_FROM_ISR
     //TODO: remove strstr and compare character singly
     if( (strstr((const char*)obj->rxData.buffer, obj->matchResponseFromIsr) != NULL) ||
	 	(strstr((const char*)obj->rxData.buffer, CM_CMD_ERROR_RESPONSE_FROM_ISR ) != NULL) /*exit when error or ok*/
		 ){
        obj->rxData.index = 0;
		obj->rxData.ready = 1; // completed frame
     }
	 if(strstr((const char*)obj->rxData.buffer, CM_CMD_URC_RESPONSE_FROM_ISR ) != NULL){
		 if(rxChar == '\n'){
			obj->rxData.index = 0;
			obj->rxData.ready = 1; // completed frame
			obj->rxData.asyncEvent = 1; // async event frame
		 }
	 }
	 #else
	 IsrStrResponseCmpManually(obj, rxChar);
	 #endif
}

// Assembly:
leal -0x7b(%rsi), %eax
cmpb $-0x71, %al
jb 0x154c
movb 0x20(%rdi), %al
cmpb $0x1, %al
jne 0x146a
movq 0x18(%rdi), %rax
movzwl 0x32(%rdi), %ecx
leal 0x1(%rcx), %edx
movw %dx, 0x32(%rdi)
movb %sil, (%rax,%rcx)
movzwl 0x32(%rdi), %eax
cmpw $0x401, %ax             # imm = 0x401
jb 0x144b
movw $0x0, 0x32(%rdi)
movq 0x18(%rdi), %rax
movzwl 0x32(%rdi), %ecx
movb $0x0, (%rax,%rcx)
cmpb $0xa, %sil
jne 0x149d
movb $0x0, 0x20(%rdi)
movb $0x1, 0x22(%rdi)
incb 0x23(%rdi)
jmp 0x149d
movl 0xc158(%rip), %eax      # 0xd5c8
leal 0x1(%rax), %ecx
xorl %edx, %edx
cmpq $0x2, %rax
sete %r8b
leaq 0x5b80(%rip), %r9       # 0x7004
cmovel %edx, %ecx
cmpb %sil, (%rax,%r9)
cmovnel %edx, %ecx
sete %al
andb %r8b, %al
movl %ecx, 0xc12e(%rip)      # 0xd5c8
movb %al, 0x20(%rdi)
movb 0x21(%rdi), %al
cmpb $0x1, %al
je 0x154c
movq 0x10(%rdi), %rax
movzwl 0x30(%rdi), %ecx
movb %sil, (%rax,%rcx)
incw 0x30(%rdi)
movzwl 0x30(%rdi), %eax
movq 0x28(%rdi), %rcx
decq %rcx
cmpq %rax, %rcx
ja 0x14ce
movw $0x0, 0x30(%rdi)
movq 0x10(%rdi), %rax
movzwl 0x30(%rdi), %ecx
movb $0x0, (%rax,%rcx)
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0x154c
movq 0xc0ce(%rip), %r9       # 0xd5b8
pushq $0x3
popq %rdx
movq 0xc0cc(%rip), %rcx      # 0xd5c0
xorl %r8d, %r8d
subl $0x1, %edx
jb 0x154c
movq (%rax,%r9,8), %r10
cmpb %sil, (%r10,%rcx)
je 0x1525
andq $0x0, 0xc0b2(%rip)      # 0xd5c0
cmpq $0x2, %r9
leaq 0x1(%r9), %r9
cmoveq %r8, %r9
movq %r9, 0xc097(%rip)       # 0xd5b8
xorl %ecx, %ecx
jmp 0x14f7
cmpq 0x38(%rdi,%r9,8), %rcx
jne 0x1542
movb $0x1, 0x21(%rdi)
andq $0x0, 0xc080(%rip)      # 0xd5b8
movw $0x0, 0x30(%rdi)
xorl %ecx, %ecx
jmp 0x1545
incq %rcx
movq %rcx, 0xc074(%rip)      # 0xd5c0
retq