📄 sgip_const.h
字号:
/*
sgip_const.h
定义错误码部分
*/
#ifndef _SMAL_SGIP_CONST_H
#define _SMAL_SGIP_CONST_H
//#include <smal.h>
#include "smal.h"
//#include <sgip/sgip_message.h>
#include "sgip_message.h"
const int SGIP_SEND_TIMEOUT = 3;
const int SGIP_RECV_TIMEOUT = 30;
const int MAXINITWORKTHREADS = 64;
const int MAXWORKTHREADS = 256;
/////////////////////////////////////////////////////////////////////////////////////////
//错误码定义
//
const int SGIP_SUCCESS = 0;
const int SGIP_ERROR_START = 10000;
const int SGIP_EINVALSOCK = SGIP_ERROR_START + 1;
const int SGIP_EINVAL = SGIP_ERROR_START + 2;
const int SGIP_HOST_UNREACHABLE = SGIP_ERROR_START + 3; //smg没返回参数
const int SGIP_TIMEOUT = SGIP_ERROR_START + 4;
const int SGIP_USERINVAL = SGIP_ERROR_START + 5;
const int SGIP_DISCONNECT = SGIP_ERROR_START + 6;
const int SGIP_TOOHIGH_VERSION = SGIP_ERROR_START + 9;
/*SOCKET ERROR*/
const int SGIP_SOCKET_CREATEFAIL = SGIP_ERROR_START + 100;
const int SGIP_SOCKET_CONNECTFAIL = SGIP_ERROR_START + 101;
const int SGIP_SOCKET_SENDTIMEOUT = SGIP_ERROR_START + 102;
const int SGIP_SOCKET_SENDERROR = SGIP_ERROR_START + 103;
const int SGIP_SOCKET_CLOSED = SGIP_ERROR_START + 104;
const int SGIP_SOCKET_RECVTIMEOUT = SGIP_ERROR_START + 105;
const int SGIP_SOCKET_RECVERROR = SGIP_ERROR_START + 106;
const int SGIP_CLOSESOCKET_ERROR = SGIP_ERROR_START + 107;
const int SGIP_UNSENDALL = SGIP_ERROR_START + 108;
const int SGIP_SOCKET_SIZE_ERROR = SGIP_ERROR_START + 109;
const int SGIP_ILLEGAL_CMD = SGIP_ERROR_START + 110;
const int SGIP_LOGINFAIL = SGIP_ERROR_START + 111;
const int SGIP_SOCKET_BINDFAIL = SGIP_ERROR_START + 112;
const int SGIP_SOCKET_ACCEPTFAIL = SGIP_ERROR_START + 113;
const int SGIP_API_EXCEPTION = SGIP_ERROR_START + 200;
const int SGIP_SOCKET_EXCEPTION = SGIP_ERROR_START + 300;
const int SGIP_API_INVALPARAM = SGIP_ERROR_START + 400;
const int SGIP_SOCKET_INVALPARAM = SGIP_ERROR_START + 500;
const int SGIP_SGIPPKG_TOOLONG = SGIP_ERROR_START + 600; //SGIP消息包不能超过2K
const int SGIP_ERROR_LOGINNAMEPWD = 1;
const int SGIP_ERROR_TOOMUCHCONNECTIONS = 3; //连接过多
//
/////////////////////////////////////////////////////////////////////////////////////////
//
// 消息ID定义
const int SGIP_BIND = 0x1;
const int SGIP_BIND_RESP = 0x80000001;
const int SGIP_UNBIND = 0x2;
const int SGIP_UNBIND_RESP = 0x80000002;
const int SGIP_SUBMIT = 0x3;
const int SGIP_SUBMIT_RESP = 0x80000003;
const int SGIP_DELIVER = 0x4;
const int SGIP_DELIVER_RESP = 0x80000004;
const int SGIP_REPORT = 0x5;
const int SGIP_REPORT_RESP = 0x80000005;
const int ERR_STATUSREPORT = 0x00; //只有最后出错时要返回状态报告.
const int NEED_STATUSREPORT = 0x01; //无论最后是否成功都要返回状态报告.
const int NO_STATUSREPORT = 0x02; //不需要返回状态报告.
const int CTRL_TYPE = 0x03; //仅携带包月计费信息,不下发给用户.
const int MSG_FORMAT_ASCII = 0x00; //纯ASCII字符串
const int MSG_FORMAT_WRITE_CARD = 0x03; //写卡操作
const int MSG_FORMAT_BINARY = 0x04; //二进制编码
const int MSG_FORMAT_UCS2 = 0x08; //UCS2编码
const int MSG_FORMAT_GB = 0x0F; //GBK编码
const int MSG_FORMAT_OTA = 0xF6; //OTA操作时的编码方式
const int TPPROTO_SMS = 0X00; //普通短信的协议类型
const int TPPROTO_WRITE_CARD = 0X7F; //OTA操作时的协议类型
//
// 消息包长度定义
//
const int SGIP_HEADLEN = sizeof(sgipg_head); //消息头的长度
const int SGIP_LOGINLEN = sizeof(sgipg_connect); //登录消息包体的长度
const int SGIP_RESPLEN = sizeof(sgipg_resp); //应答包体的长度
const int SGIP_SUBMITLEN = sizeof(sgipg_submit); //MT消息体的长度
const int SGIP_DELIVERLEN = sizeof(sgipg_deliver); //MO消息体的长度
const int SGIP_REPORTLEN = sizeof(sgipg_report); //Report消息体的长度
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -