// File: /workspace/github_cpp_makefile_star2_O2/CDISC2020[P]Projet_satellite_agile/src/communication/Ground.cpp
// Function: main
int main (int argc,char* argv[])
{
	char cmde[100];
	char name[9];

	cout << "Welcome to the Ground Station, ";

	while (1)
	{
		cout << "what do you want to do ?"<< endl;
		cout << "'p' to send a plan\n" << "'c' to send a commande\n" << "'r' to receive the photos\n" << endl;
		char c;
		scanf(" %c", &c);

		if (c == 'p')	// Envoi d'un plan
		{
			cout << "What is the plan name ? (end it by '.txt')" << endl;
			scanf("%9s[^\n]", name);
			cout << "Sending Plan..." << endl;
			sprintf(cmde, "sh ../src/communication/uploadGtoSplans.sh %s", name);
			system(cmde);
			sleep(2);

			cout << "Plan sent !" << endl;
		}

		else if (c=='c')  // Envoi d'une commande
		{
			cout << "What is the commande name ? (end it by '.txt')" << endl;
			scanf("%9s[^\n]", name);
			cout << "Sending Commande..." << endl;
			sprintf(cmde, "sh ../src/communication/uploadGtoStm.sh %s", name);
			system(cmde);
			sleep(2);

			cout << "Commande sent !" << endl;
		}

		else if (c=='r')  // Demande des photos
		{
			sprintf(cmde, "sh ../src/communication/uploadGtoSplans.sh demande_imgs.txt");
			system(cmde);
			printf("Demande image envoyée");
			cout << "Receiving the images..." << endl;
			sleep(2);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq 0x2dc4(%rip), %rbx      # 0x3fd8
leaq 0xde9(%rip), %rsi       # 0x2004
movq %rbx, %rdi
callq 0x1090
leaq 0xe5a(%rip), %r14       # 0x2084
leaq -0x29(%rbp), %r15
leaq -0x32(%rbp), %r12
leaq -0xa0(%rbp), %r13
movq %rbx, %rdi
leaq 0xde1(%rip), %rsi       # 0x2024
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq %rbx, %rdi
leaq 0xde3(%rip), %rsi       # 0x203d
callq 0x1090
movq %rax, %rdi
leaq 0xde8(%rip), %rsi       # 0x2051
callq 0x1090
movq %rax, %rdi
leaq 0xdf1(%rip), %rsi       # 0x2069
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
movzbl -0x29(%rbp), %eax
cmpl $0x63, %eax
je 0x1387
cmpl $0x72, %eax
je 0x131b
cmpl $0x70, %eax
jne 0x1239
movq %rbx, %rdi
leaq 0xdd5(%rip), %rsi       # 0x2088
callq 0x1090
movq %rax, %rdi
callq 0x1050
leaq 0xdec(%rip), %rdi       # 0x20b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movq %rbx, %rdi
leaq 0xde0(%rip), %rsi       # 0x20bb
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq %r13, %rdi
leaq 0xdd9(%rip), %rsi       # 0x20cb
movq %r12, %rdx
xorl %eax, %eax
callq 0x1040
movq %r13, %rdi
callq 0x1070
pushq $0x2
popq %rdi
callq 0x1060
movq %rbx, %rdi
leaq 0xde3(%rip), %rsi       # 0x20f9
jmp 0x13f4
movups 0xe8d(%rip), %xmm0      # 0x21af
movups %xmm0, -0x74(%rbp)
movups 0xe76(%rip), %xmm0      # 0x21a3
movaps %xmm0, -0x80(%rbp)
movups 0xe5b(%rip), %xmm0      # 0x2193
movaps %xmm0, -0x90(%rbp)
movups 0xe3d(%rip), %xmm0      # 0x2183
movaps %xmm0, -0xa0(%rbp)
movq %r13, %rdi
callq 0x1070
leaq 0xe63(%rip), %rdi       # 0x21bf
xorl %eax, %eax
callq 0x1030
movq %rbx, %rdi
leaq 0xe69(%rip), %rsi       # 0x21d6
callq 0x1090
movq %rax, %rdi
callq 0x1050
pushq $0x2
popq %rdi
callq 0x1060
jmp 0x1239
movq %rbx, %rdi
leaq 0xd74(%rip), %rsi       # 0x2105
callq 0x1090
movq %rax, %rdi
callq 0x1050
leaq 0xd0e(%rip), %rdi       # 0x20b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movq %rbx, %rdi
leaq 0xd7b(%rip), %rsi       # 0x2134
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq %r13, %rdi
leaq 0xd78(%rip), %rsi       # 0x2148
movq %r12, %rdx
xorl %eax, %eax
callq 0x1040
movq %r13, %rdi
callq 0x1070
pushq $0x2
popq %rdi
callq 0x1060
movq %rbx, %rdi
leaq 0xd7f(%rip), %rsi       # 0x2173
callq 0x1090
movq %rax, %rdi
callq 0x1050
jmp 0x1239