LingYun IoT Studio NB-IoT research project
guowenxue
2018-11-19 ec8c799d8bb2ee69b5e6f56201231e8c905edeb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/********************************************************************************
 *      Copyright:  (C) guowenxue <guowenxue@gmail.com>
 *                  All rights reserved.
 *
 *       Filename:  atcmd.h
 *    Description:  This is the head file for atcmd.c
 *
 *        Version:  1.0.0(05/15/2012~)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "05/15/2012 05:31:10 PM"
 *                 
 ********************************************************************************/
 
#ifndef __CP_ATCMD_H
#define __CP_ATCMD_H
 
#include "cp_comport.h"
 
/* AT+CPSI command return important result*/
typedef struct gprs_location_s
{
    char            longitude[15];
    char            latitude[15];
    char            date[15];
    char            time[15];
    char            mcc_mnc[16];/*   Mobile Country Code, China is 460 */
} gprs_location_t;
 
typedef struct reginfo_s 
{
    int             type;       /*  SIM card register type: REG_HOMEWORK,REG_SEARCHING... */
    int             signal;     /*  GPRS signal */ 
    char            carrier[64];/*  Network operator */
    gprs_location_t   loc;        /*  Location */
} reginfo_t;
 
 
typedef struct _hwinfo_s
{
    char            model[64];  /*  AT+CGMM check GPRS module model */
    char            mrev[64];   /*  AT+CGMR check GPRS module revision */
    char            iemi[64];   /*  AT+CGSN check GPRS module IEMI(International Mobile station Equipment Identity) number */
} hwinfo_t;
 
extern int send_atcmd(comport_t *comport, char *atCmd, char *expect, char *error, 
       unsigned long timeout, char *reply, int reply_len);
 
extern int send_atcmd_check_ok(comport_t *comport, char *atcmd, unsigned long timeout);
extern int send_atcmd_check_value(comport_t *comport, char *atcmd, unsigned long timeout, char *buf, int buf_len);
extern int send_atcmd_check_request(comport_t *comport, char *atcmd, unsigned long timeout, char *buf, int buf_len);
 
 
extern int atcmd_check_at_ready(comport_t *comport); /* Send ATE0 command */
extern int atcmd_check_sim_valid(comport_t *comport); /* Send AT+CPIN? command */
extern int atcmd_check_gprs_signal(comport_t *comport); /* Send AT+CSQ command */
extern int atcmd_check_gprs_register(comport_t *comport);
extern int atcmd_check_gprs_carrier(comport_t *comport, char *carrier);
extern int atcmd_check_gprs_name(comport_t *comport, char *name);
extern int atcmd_check_gprs_version(comport_t *comport, char *version);
extern int atcmd_check_gprs_iemi(comport_t *comport, char *iemi);
extern int atcmd_check_gprs_network(comport_t *comport, int *network);
extern int atcmd_check_gprs_location(comport_t *comport, gprs_location_t *location);
extern int atcmd_check_gprs_mcc_mnc(comport_t *comport, char *mcc_mnc);
 
extern int atcmd_set_network_mode(comport_t *comport, int mode);
extern int atcmd_set_apn(comport_t *comport, char *apn);
 
#endif /* _CP_ATCMD_H */