air720u_test.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // +build ignore
  2. #include "air720u.h"
  3. // 主函数入口, 测试联网
  4. int main(int argc,char *argv[])
  5. {
  6. int ret = Air720U_ComInit();
  7. if(ret < 0)
  8. {
  9. sw_log_error("an error occurred while calling the Air720U_ComInit() function(%d)!!", ret);
  10. goto end_p;
  11. }
  12. char MMEI[16] = { 0 };
  13. ret = Air720U_GetIMEI(MMEI);
  14. if(ret < 0)
  15. {
  16. sw_log_error("an error occurred while calling the Air720U_GetIMEI() function(%d)!!", ret);
  17. goto end_p;
  18. }
  19. sw_log_info("IMEI: %s", MMEI);
  20. ret = Air720U_GetCregState();
  21. if(ret < 0)
  22. {
  23. sw_log_error("an error occurred while calling the Air720U_GetCregState() function(%d)!!", ret);
  24. goto end_p;
  25. }
  26. sw_log_info("Creg State: %d", ret);
  27. ret = Air720U_GetRSSIFromCSQ();
  28. if(ret < 0)
  29. {
  30. sw_log_error("an error occurred while calling the Air720U_GetRSSIFromCSQ() function(%d)!!", ret);
  31. goto end_p;
  32. }
  33. sw_log_info("RSSI: %d", ret);
  34. ret = Air720U_IsSimCardReady();
  35. if(ret < 0)
  36. {
  37. sw_log_error("an error occurred while calling the Air720U_IsSimCardReady() function(%d)!!", ret);
  38. goto end_p;
  39. }
  40. sw_log_info("SIM card status: %d", ret);
  41. char ICCID[21] = { 0 };
  42. ret = Air720U_GetSimICCID(ICCID);
  43. if(ret < 0)
  44. {
  45. sw_log_error("an error occurred while calling the Air720U_GetSimICCID() function(%d)!!", ret);
  46. goto end_p;
  47. }
  48. sw_log_info("ICCID: %s", ICCID);
  49. end_p:
  50. Air720U_ComExit();
  51. return ret;
  52. }