⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_mt.c

📁 中兴SMGP通信协议接口,API函数,编写该通信协议下的程序可调有其中的函数
💻 C
字号:
#include <stdio.h>
#include <string.h>
#include "../include/smgpapi.h"

int main()
{
	int res;
	char msgid[11];
	int errcode;
	struct SendBatchResp sendbatchresp;
 	
 	char msg[]="测试";
 	
 	int msglen;
 	
 	msglen=strlen(msg);
 	
	res=InitSMGPAPI("../config/smgpc.ini");
	if (res!=0)
	{
		printf("init config file error\n");
		return 1;
	}
	else 
	{
		printf("init config file ok\n");
	}
//login
	res=login(0);
	if (res!=0)
	{
		printf("login error \n");
		return 1;
	}
	 
//active test
//	res=CMMPActiveTest(&errcode);
//	printf("active test return errcode=%d \n",errcode);


//send single
	res=SMGPSendSingle (1,3,"funcid",15,"00","000000","0","0","7556551049","7556551049","7556551320",5,"hello",msgid,&errcode);
	if (res!=0)
	{
		printf("send single error \n");
		return 1;
	}
	else
	{
		msgid[10]=0;
		printf("submit ok.msgid =%s  errcode=%d \n",msgid,errcode);
		 
	}
	
	res=SMGPSendSingle (1,3,"funcid",15,"tr","000000","0","0","7556551049","7556551049","7556551320",5,"hello",msgid,&errcode);
	if (res!=0)
		printf("send single error \n");
	else
	{
		msgid[10]=0;
		printf("submit ok.msgid =%s  errcode=%d \n",msgid,errcode);
		 
	}

 
//send batch

	res=SMGPSendBatch  (1,3,"funcid",15,"00","000000","0","0","7556551049","dest","msg","msgid");
 	if (res!=0)
	{
 		printf("send batch error \n");
		return 1;
	}
 	else
 		printf("send batch succ \n");
//logout	
	res=logout();
	if (res!=0)
	{
		printf("logout error\n");
		return 1;
	}
	else
		printf("logout succ \n");

//get send batch resp
	res=GetSendBatchResp ("msgid",1,&sendbatchresp);
	if (res==0)
	{
		printf("msgid = %s",sendbatchresp.msgid);
		printf("dest code =%s",sendbatchresp.phonenum);
		printf("send errcode =%d \n",sendbatchresp.errorcode);
	}		
	
	return 0;
	
	 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -