资源描述
客户端DLL接口说明
l int Init()(调用该DLL之前应该先调用该函数)
返回值:成功返回0,失败返回-1
l int KeepoutAlarm (char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:视频遮挡报警开关
参数:
pItemName:形如HIE$192.168.0.10=5050;Admin;888888,等号之前给pItemName
pItemContent:等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int AlarmInAlarmOn (char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:报警输入布防
参数:
pItemName:形如HIE9000$192.168.0.11=布防字符串,等号之前给pItemName
pItemContent:等号之后即布防字符串给pItemContent
返回值:成功返回0,失败返回-1
l int OnOffVilost(char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:视频丢失报警开关
参数:
pItemName:形如HIE9000$192.168.0.11=channelnum;0,等号之前给pItemName
pItemContent:等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int OnOffVideoMove(char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:视频移动报警开关
参数:
pItemName:形如HIE9000$192.168.0.11=channelnum;0,等号之前给pItemName
pItemContent: 等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int DeviceLog(char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:设备注册注销
参数:
pItemName:形如HIE$192.168.0.10=5050;Admin;888888,等号之前给pItemName
pItemContent:等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int AlarmCancel(char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:消警
参数:
pItemName:形如HIE$192.168.0.10=5050;Admin;888888,等号之前给pItemName
pItemContent:等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int AlarmOutput(char *pMsgServerIP,
short sMsgServerPort,
char *pItemName,
char *pItemContent)
功能:报警输出
参数:
pItemName:形如HIE$192.168.0.10=5050;Admin;888888,等号之前给pItemName
pItemContent:等号之后给pItemContent
返回值:成功返回0,失败返回-1
l int GetDeviceOnLine(char *pMsgServerIP,
short sMsgServerPort,
CTS_MSGSTR_DEVICEONLINE_EX *pDeviceOnLine_in,
char *pDevAddr,//从该项开始的参数为传出结构体拆开得来
int &iDevType,
int &iDevSubType,
int &bOnline,
time_t &lastpingtime,
time_t &currtime,
bool &bFindDev)
功能:查询设备在线等信息
参数:
pDeviceOnLine_in:指向CTS_MSGSTR_DEVICEONLINE_EX的指针(in),定义如下:
typedef struct _CTS_MSGSTR_DEVICEONLINE_EX
{
char *pDevAddr; //设备ip或者imei号,dtu就是userid
int iDevType; //设备主类型,比如MP902
int iDevSubType; //是不是还该有个子类型,比如dtu的,=1表示是个dtu,否则不是
int bOnline; //是否在线,1为在线(此时m_lastpingtime值无效),其他值表示不可知该设备是否在线,需要参考m_lastpingtime
time_t lastpingtime; //上次ping(收到活动数据包)的时间,0表示bOnline项有效而本项无效(只能判断是否在线)
time_t currtime; //当前的时间
bool bFindDev; //是否有该设备的痕迹,client端应该先判断此,从而知道消息服务器中是否有该设备的信息
}CTS_MSGSTR_DEVICEONLINE_EX,*LPCTS_MSGSTR_DEVICEONLINE_EX;
返回值:成功返回0,失败返回-1
l int SetMsgServer(char *pMsgServerIP,
short sMsgServerPort,
char *pClientIP,
short sClientPort,
char *pUserID,
int Flag)
功能:设置消息服务器,第一次和某一消息服务器通讯必须首先调用该函数
参数:
pMsgServerIP:你要通讯的消息服务器IP
sMsgServerPort:你要通讯的消息服务器端口
pClientIP:你自己的(客户端)IP
sClientPort:你自己的端口号
pUserID:用户ID
Flag:标志,传字符“0”消息服务器会删除保存着的你的IP及端口信息,首次调用传字符“1”,消息服务器会把你的IP及端口信息保存起来
返回值:成功返回0,失败返回-1
l int ConnectSignalServer(char *pSignalServerIP,
short sSignalServerPort,
char *pClientIP,
short sClientPort,
char *pUserID,
char *Flag)
功能:长连接订阅信令服务
参数:
pSignalServerIP:信令服务IP
sSignalServerPort:信令服务端口
pClientIP:客户端IP
sClientPort:客户端端口
pUserID:用户登入帐号
Flag:标志,字符“0”代表取消订阅,字符“1”代表订阅
l int SetSignalServer(char *pSignalServerIP,
short sSignalServerPort,
char *pClientIP,
short sClientPort,
char *pUserID,
int Flag)
功能:设置信令服务器,第一次和某一信令服务器通讯必须首先调用该函数
参数:
pMsgServerIP:你要通讯的消息服务器IP
sMsgServerPort:你要通讯的消息服务器端口
pClientIP:你自己的(客户端)IP
sClientPort:你自己的端口号
pUserID: 登入ID,对于每个客户端来说是唯一值
Flag:标志,传字符“0”信令服务器会删除保存着的你的IP及端口信息,首次调用传字符“1”,信令服务器会把你的IP及端口信息保存起来
返回值:成功返回0,失败返回-1
l int Exit()
功能:当不再使用该DLL时,可以调用此函数释放DLL占用的资源。
返回值:成功返回0,失败返回-1
l int PasswordChange(char* pUserPhone,
char *pSIM,
char *pDeviceType,
char *pOld,
char *pNew,
char *pErrorCode);
功能:修改密码(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:指向SIM卡号字符串的指针(下同)
pDeviceType:指向设备类型标示符的指针(下同)
pOld:旧密码(密码只能是4位字符)
pNew:新密码
pErrorCode:返回:函数具体执行状况,返回50字节的内容,所以给的内存必须大于等于50字节,下同
返回值:成功返回0,失败返回-1
l int AlarmMode(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sAlarmMode,
char *pErrorCode);
功能:紧急键报警方式(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
sAlarmMode:取值为0,拨打电话;取值为1,发送短信及照片,取其余值,非法。
返回值:
成功返回0,失败返回-1
l int AlarmOn(char *pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:布防(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:撤防(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SensorAdd(char *pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pSensorType,
char *pSensorName,
char *pErrorCode)
功能:增加传感器(mp902,mp903通用)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pSensorType:传感器类型,0代表有线,1代表无线
pSensorName:传感器名称,只能是英文或数字,最多50位
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SensorDel(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pSensorType,
char *pSensorName,
char *pErrorCode)
功能:删除传感器(mp902调用删除全部传感器,mp903调用删除某个传感器)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pSensorType:传感器类型,0代表有线,1代表无线
pSensorName:传感器名,用于902传空字符串,用于903传某个传感器名
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int RemotecontrollerDel(char* pUserPhone,
char *pSIM,
char *pPassword
char *pDeviceType,
char *pErrorCode)
功能:删除遥控器(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int InfraredDeviceOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:开启内置红外人体探测器(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int InfraredDeviceOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:关闭内置红外人体探测器(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int InfraredLightOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:红外灯关(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int InfraredLightOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:红外灯开(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1,
l int GetPhotos(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sNum,
char *pErrorCode)
功能:索取照片(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
sNum:照片张数,照片图像的大小设置为160x128或者320x240时,一次可以请求最多8张照片;当照片图像的大小设置为640x480时,则最多一次可以请求2张照片
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SendPhotosToMobile(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sNum,
char *pPhoneNum,
char *pErrorCode)
功能:索取照片到指定手机(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
sNum:照片张数;
pPhoneNum:指定的手机号
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int ResetDevice(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:恢复运营商设置(mp902,mp903)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SetMMSCenter(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pNetWeb,
char *pErrorCode)
功能:设置彩信中心(mp902,mp903)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pNetWeb:彩信中心网站(字符串形式)
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SetMMSAPN(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pGateWay,
short sPort,
char *pAPN,
char *pUser,
char *pAPNPassword,
char *pErrorCode)
功能:设置彩信APN参数(mp902,mp903)
参数:
pUserPhone:传一个随机手机号的字符串就行
pGateway:网关
sPort:端口
pAPN:APN
pUser:APN用户名
pPassword:APN密码
返回值:成功返回0,失败返回-1
l int AlarmSendSMSOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时不发短信(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmSendSMSOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时发短信(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmCallPhoneOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时不拨打主人电话(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmCallPhoneOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时拨打主人电话(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmSendPhotoOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时不发照片(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l 报警时发照片int AlarmSendPhotoOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:报警时发照片(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int AlarmSendPhotos(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sNum,
char *pErrorCode)
功能:报警时发送照片张数(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
sNum:照片张数,张数为数字2到8,默认5张,如果照片大小为640x480(像素),则最多2张
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int TimingSendPhotoOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:定时发送照片开始(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int TimingSendPhotoOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:定时发送照片关闭(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int SendPhotoTime (char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *WorkDay,
char *pStartTime1,
char *pEndTime1,
short sTimeLag1,
char *pStartTime2,
char *pEndTime2,
short sTimeLag2,
char *pStartTime3,
char *pEndTime3,
short sTimeLag3,
char *pErrorCode)
功能:设置定时发送照片时间段(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
WorkDay:工作日,取字符“0”至“8”,具体含义请参阅移动卫士用户手册
pStartTime1:开始时间(4位数字,24小时制,例如:0000表示零点零分,2359表示23点59分)
pEndtime1:终止时间,(参见开始时间)
sTimelag1:时间间隔(一至三位数字,1至480,代表在设定的发送时段内自动发送照片的时间间隔,单位为分钟),1~480分钟的时间间隔
pStartTime2:上同
pEndTime2:上同
sTimeLag2:上同
pStartTime3:上同
pEndTime3:上同
sTimeLag3:上同
返回值:成功返回0,失败返回-1
l int MoveTestOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:移动侦测关闭(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int MoveTestOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:移动侦测打开(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
pSIM:SIM卡号
pPassword:密码
pDeviceType:设备类型
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int MoveTestLevel (char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sLevel,
char *pErrorCode)
功能:移动侦测灵敏度(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
sLevel:灵敏度等级,取值为1、2、3、4、5(1为最暗,5为最亮),默认为4
返回值:成功返回0,失败返回-1
l int PhotoSize(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sSize,
char *pErrorCode)
功能:照片图像大小(mp902)
参数:
pUserPhone:传一个随机手机号的字符串就行
sSize:参数为1:160x128(常用较小手机分辨率)
参数为2:QVGA大小320x240
参数为3:VGA大小640x480
返回值:成功返回0,失败返回-1
l int PhotoBrightness(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sBrightness,
char *pErrorCode)
功能:照片图像亮度(mp902)
参数:
sBrightness:等级可选项:1、2、3、4、5(1为最暗,5为最亮)
返回值:成功返回0,失败返回-1
l int PhotoContrast(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sContrast,
char *pErrorCode)
功能::照片图像对比度(mp902)
参数:
sContrast:等级可选项:1、2、3、4、5,从1至5表示对比度从弱到强递增
返回值:成功返回0,失败返回-1
l int PhotoDirection(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sDirection,
char *pErrorCode)
功能:照片图像方向(mp902)
参数:
sDirection:参数为1倒立,2横放,3正常,默认为3
返回值:成功返回0,失败返回-1
l int PhotoZip(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sZip,
char *pErrorCode)
功能:照片图像压缩率(mp902)
参数:
sZip:参数值为1是20倍;参数值为2是14倍;参数值为3是10倍;参数值为4是5倍
返回值:成功返回0,失败返回-1
l int ChineseToEnglish (char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:中文切换英文版本(mp902,mp903)
返回值:成功返回0,失败返回-1
l int EnglishToChinese(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:英文切换中文版本(mp902,mp903)
返回值:成功返回0,失败返回-1
l int MP902_DeviceRegister(DEVICEREGISTER *pDeviceRegister, char *pErrorCode)
功能:注册设备(mp902)
参数:pDeviceRegister指向以下结构体,pErrorCode返回错误码
typedef struct
{
char *pUserPhone;
char *pDeviceID;
char *pCommand1MD5;
char *pCommand2MD5;
char *pHostNum;
char *pMsgServerIP;
char *pSIM;
}DEVICEREGISTER, *LPDEVICEREGISTER;
返回值:成功返回0,失败返回-1
l int SendRegisterInfoOn(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:定时发送注册帧打开 (mp902)
返回值:成功返回0,失败返回-1
l int SendRegisterInfoOff(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
char *pErrorCode)
功能:定时发送注册帧关闭 (mp902)
返回值:成功返回0,失败返回-1
l int SendRegisterInfoTime(char* pUserPhone,
char *pSIM,
char *pPassword,
char *pDeviceType,
short sTimeLag,
char *pErrorCode)
功能:定时发送注册帧时间段(mp902)
参数:
sTimeLag:时间段
返回值成功返回0,失败返回-1
l int SendSMS (char *pPhone, char *pCommandContent, char *pErrorCode)
功能:发送命令
参数:
pPhone:目的手机号,多个手机号的话,用英文逗号分隔
pCommandContent:短信内容(我只copy你100字节的内容)
pErrorCode:错误码
返回值:成功返回0,失败返回-1
l int MP902_SetDeviceInfo(char *pUserPhone, PStruct_DevInfo pDevInfo,char *pErrorCode)
功能:设置设备(mp902)
参数:
pUserPhone:用户手机号
pDevInfo:指向下面结构体的指针
pErrorCode:返回错误码
typedef struct
{
char *pIMEI; //IMEI号
char *pSIM; //SIM号
char *pRegisterMsg1; //注册指令
char *pRegisterMsg2; //注册指令
char *pPassword; //当前密码
char *pNewPassword; //新密码
char *pDeviceType; //设备类型
int AlarmMode; //报警方式
int Alarm; //布防开关
char *pSensorNames; //传感器名称(名称#名称#...#)
int InfraredDevice; //红外人体探测器开关
int InfraredLight; //红外灯开关
char *pMMSCenter; //彩信中心
char *pMMSAPN; //彩信APN参数(网关#端口#APN#APN用户名#APN密码#)
int AlarmSendSMS; //报警发送短信开关
int AlarmCallPhone; //报警拨打电话开关
int AlarmSendPhoto; //报警发送照片开关
int AlarmS
展开阅读全文