/********************************************************************************
|
* 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 */
|