// +build ignore

#include "ec200u.h"

// 主函数入口, 测试联网
int main(int argc,char *argv[])
{
  int ret = EC200U_ComInit();
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_ComInit() function(%d)!!", ret);
    goto end_p;
  }

  char MMEI[16] = { 0 };
  ret = EC200U_GetIMEI(MMEI);
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_GetIMEI() function(%d)!!", ret);
    goto end_p;
  }
  sw_log_info("IMEI: %s", MMEI);

  ret = EC200U_GetCregState();
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_GetCregState() function(%d)!!", ret);
    goto end_p;
  }
  sw_log_info("Creg State: %d", ret);

  ret = EC200U_GetRSSIFromCSQ();
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_GetRSSIFromCSQ() function(%d)!!", ret);
    goto end_p;
  }
  sw_log_info("RSSI: %d", ret);

  ret = EC200U_IsSimCardReady();
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_IsSimCardReady() function(%d)!!", ret);
    goto end_p;
  }
  sw_log_info("SIM card status: %d", ret);

  char ICCID[21] = { 0 };
  ret = EC200U_GetSimICCID(ICCID);
  if(ret < 0)
  {
    sw_log_error("an error occurred while calling the EC200U_GetSimICCID() function(%d)!!", ret);
    goto end_p;
  }
  sw_log_info("ICCID: %s", ICCID);

end_p:
  EC200U_ComExit();
  return ret;
}
