// File: /workspace/github_cpp_makefile_star2_O1/CDISC2020[P]Projet_satellite_agile/src/communication/comGroundManager.cpp
// Function: Communic_Interne(void*)
void* Communic_Interne(void* args)
{
	QueuingPort channelIn(1, 18003, s); 		// Server
	usleep(500000);
	channelIn.Display();
	usleep(300000);

	while(1)
	{
		channelIn.RecvQueuingMsg(buffer);

		status = (Status*)buffer;

 		/**************[ PM ---IMG---> CGM ]**************/
		// Remplir le tableau avec des photos prises
		if (status->code == 3)		// utilisation d'un type p
		{
			imageName = (PlanFilePath*)buffer;
			string aux(imageName->filepath);
			imageList[ptImageReceived] = aux;
			ptImageReceived = (ptImageReceived + 1)%128;
		}

 		/**************[ PM ---LOG---> CGM ]**************/
		// Plan manager --> Comunication Manager
		// Error identifier and description
		else if(status->code == 4)
		{
			string str(status->description);
			sm.newNotification(status->errorID, str);
		}

		/*************[ FDIR ---MODE---> CGM ]*************/
		// changement mode primary ou backup
		else if(status->code == 6)
		{
			m = (ModeStruct*)buffer;
			mode = m->rpiMode;
		}

		usleep(100);
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x508, %rsp            # imm = 0x508
leaq 0x51f0(%rip), %rcx      # 0x92f0
leaq -0x530(%rbp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
movl $0x4653, %edx           # imm = 0x4653
callq 0x2866
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2370
movq %rbx, %rdi
callq 0x2da8
movl $0x493e0, %edi          # imm = 0x493E0
callq 0x2370
leaq -0x38(%rbp), %r15
leaq 0x5220(%rip), %r14      # 0x9360
leaq -0x68(%rbp), %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b68
movq %r14, 0x416a(%rip)      # 0x82c0
movl 0x5204(%rip), %eax      # 0x9360
cmpl $0x6, %eax
je 0x428c
cmpl $0x4, %eax
je 0x420b
cmpl $0x3, %eax
jne 0x429f
movq %rbx, %r12
movq %r14, 0x4157(%rip)      # 0x82d8
movq %r15, %rbx
movq %r15, -0x48(%rbp)
leaq 0x51d5(%rip), %r15      # 0x9364
movq %r15, %rdi
callq 0x2130
leaq (%rax,%r14), %rdx
addq $0x4, %rdx
leaq -0x48(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x3398
movslq 0x512b(%rip), %rdi      # 0x92e0
shlq $0x5, %rdi
leaq 0x4120(%rip), %rax      # 0x82e0
addq %rax, %rdi
movq %r13, %rsi
callq 0x2170
movl 0x510f(%rip), %eax      # 0x92e0
leal 0x1(%rax), %ecx
leal 0x80(%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
andl $-0x80, %edx
negl %edx
addl %edx, %eax
incl %eax
movl %eax, 0x50f2(%rip)      # 0x92e0
movq -0x48(%rbp), %rdi
movq %rbx, %r15
cmpq %rbx, %rdi
je 0x41ff
callq 0x2280
movq %r12, %rbx
leaq -0x68(%rbp), %r12
jmp 0x429f
movq %r15, -0x48(%rbp)
leaq 0x5152(%rip), %r13      # 0x9368
movq %r13, %rdi
callq 0x2130
leaq (%rax,%r14), %rdx
addq $0x8, %rdx
leaq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x3398
movq 0x4087(%rip), %rax      # 0x82c0
movl 0x4(%rax), %r13d
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4722
leaq 0x4041(%rip), %rdi      # 0x82a0
movl %r13d, %esi
movq %r12, %rdx
callq 0x31bc
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x427c
callq 0x2280
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x429f
callq 0x2280
jmp 0x429f
movq %r14, 0x403d(%rip)      # 0x82d0
movb 0x50cb(%rip), %al       # 0x9364
movb %al, 0x5049(%rip)       # 0x92e8
movl $0x64, %edi
callq 0x2370
jmp 0x4144
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x42d6
callq 0x2280
jmp 0x42d6
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x42df
jmp 0x42eb
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x42eb
callq 0x2280
jmp 0x42eb
jmp 0x42e8
movq %rax, %r14
movq %r14, %rdi
callq 0x2470