#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>

#include "uart.h"
#include "iap.h"
#include "crc.h"

#define  DELIMIERS ","
#define APP_OFFSET 4




typedef struct cmd {
  char** argv;        // a first command splitted as arguments in the argv style
  int argc;           // number of arguments in the first command
} cmd_t;



void uart_commands_getid(error_code* status);

void uart_commands_getserial(error_code* status);

crc_t uart_commands_prog(error_code* status, int size);

error_code uart_commands_data(error_code* status, int size, crc_t* checksum_global, crc_t checksum_loc, int offset);

error_code uart_commands_check(crc_t crc_received, crc_t crc_calculated);

int uart_parse_command(char *user_input, cmd_t *cmd);

void uart_send_ok();

void uart_send_err();

void digit_to_str(char* str, uint32_t number);

uint32_t uart_string_to_int(const char* str);
