C++客户端开发接口库 V5.1.8.15
连接信创集成中间件服务程序的二次开发接口
载入中...
搜索中...
未找到
mdwc::MidLinkBase类 参考

#include <MidLinkBase.h>

Public 成员函数

std::string GetMachineID ()
bool Inited ()
int GetConnectStatus (std::string &sConnectStatus)
bool GetConnectServerInfo (MIDServerInfo &sInfo)
 MidLinkBase ()
 ~MidLinkBase ()
int GetTxmmKey ()
bool OpenMidLinkComm (const std::string &sIPAdress, int iCommPort, int iTimeOut, const std::string &sTokenID="")
bool OpenMidLinkComm (const std::string &sConfigFile="", bool bConnectedServer=true)
bool SetCommCharSet (MidCharSet eCharSetID)
void RecycleMidLinkComm (int iFreeTime)
std::vector< std::string > GetMidLinkCommPoolStatus ()
CMidLinkComm * GetMidLinkComm (const std::string &sOperate)
CMidLinkComm * GetMidLinkComm (const std::string &sOperate, const std::string &sIPAdress, short iCommPort, int iTimeOut=30, const std::string &sTokenID="")
void ReleaseMidLinkComm (mdwc::CMidLinkComm *comm, bool bRemove=false)
void CloseMidLinkComm (bool bReleaseComm)
int RegisterUser (std::string UserCode, std::string UserName)
int UnRegisterUser ()
int RegisterRDMS (int iConnectNo, std::string sClientID, unsigned short wPort, bool bLogOut, bool bPMPMode)
bool SendNetMessage (mdwc::MSG_TYPE eMsgType, std::string sMsgContext)
int SendTextMessage (std::string sReceives, std::string sMsgContext, std::string sSended)
std::vector< mdwc::Logon_UserInfo > GetClientLoginInfo ()
int GetShowedMessage (mdwc::NET_MESSAGE &retmsg)
std::string GetLocalMACAddres ()
bool ReceiveMulticastFile (bool bEnabled, const std::string &sFileType="*")
std::string Encrypt10Char (const std::string &sSou, int iPinKey)
std::string Encrypt (const std::string &sSou, int iPinKey)
std::string Decrypt10Char (const std::string &sSou, int iPinKey)
std::string Decrypt (const std::string &sSou, int iPinKey)

静态 Public 成员函数

static mdwc::MidLinkBase * Initialize (const std::string &sProductName, const std::string &sVersion, const std::string &sWorkDirectory="", MidCharSet eDefaultChatSet=MidCharSet::AUTO, int iAutoRecycleCommObjectWaitTimes=120)
static void UnInitialize ()
static std::string GetLastErrorMessage ()

Public 属性

std::unique_ptr< CMidLinkDLL > MidLinkDLL
std::unique_ptr< CMDWLogger > MDWLogger
std::unique_ptr< CRDMSLogHelper > RDMSLogHelper
std::unique_ptr< CMidLinkMessage > MidLinkMessage
std::unique_ptr< CMidLinkServer > MidLinkServer

详细描述

通信连接库基类,提供初始化,获取通信连接,释放连接等基础功能

构造及析构函数说明

◆ MidLinkBase()

mdwc::MidLinkBase::MidLinkBase ( )

构造函数

这是这个函数的调用关系图:

◆ ~MidLinkBase()

mdwc::MidLinkBase::~MidLinkBase ( )

析构函数

函数调用图:

成员函数说明

◆ CloseMidLinkComm()

void mdwc::MidLinkBase::CloseMidLinkComm ( bool bReleaseComm)

关闭通信接口,释放连接资源,应用程序退出时调用。

参数
bReleaseComm是否释放通信连接库
这是这个函数的调用关系图:

◆ Decrypt()

std::string mdwc::MidLinkBase::Decrypt ( const std::string & sSou,
int iPinKey )

不定长解密函数

参数
sSou加密的密码字符
iPinKey加密Key
返回
返回原码

◆ Decrypt10Char()

std::string mdwc::MidLinkBase::Decrypt10Char ( const std::string & sSou,
int iPinKey )

定长解密函数,10位字符密码

参数
sSou20位加密的密码字符
iPinKey加密Key
返回
返回原码

◆ Encrypt()

std::string mdwc::MidLinkBase::Encrypt ( const std::string & sSou,
int iPinKey )

不定长加密函数

参数
sSou长度不限制
iPinKey加密Key
返回
返回已经加密的字符

◆ Encrypt10Char()

std::string mdwc::MidLinkBase::Encrypt10Char ( const std::string & sSou,
int iPinKey )

10位字符定长加密函数

参数
sSou长度不能超过10个字符
iPinKey加密Key
返回
返回已经加密的字符

◆ GetClientLoginInfo()

std::vector< mdwc::Logon_UserInfo > mdwc::MidLinkBase::GetClientLoginInfo ( )

取得注册的用户信息, 最大500个用户信息

返回
返回注册的用户信息

◆ GetConnectServerInfo()

bool mdwc::MidLinkBase::GetConnectServerInfo ( MIDServerInfo & sInfo)

取得当前连接的中间件配置信息.

参数
sInfo接收中间件配置信息的结构
返回
true成功、false失败

◆ GetConnectStatus()

int mdwc::MidLinkBase::GetConnectStatus ( std::string & sConnectStatus)

取得当前通信连接的状态

参数
sConnectStatus接收当前连接状态的字符变量
返回
>0 状态信息的字符长度 其字值失败

◆ GetLastErrorMessage()

std::string mdwc::MidLinkBase::GetLastErrorMessage ( )
inlinestatic

取得错误信息.

返回
返回错误信息

◆ GetLocalMACAddres()

std::string mdwc::MidLinkBase::GetLocalMACAddres ( )

取得网卡地址

返回
返回网卡地址

◆ GetMachineID()

std::string mdwc::MidLinkBase::GetMachineID ( )
inline

取得本机唯一ID

◆ GetMidLinkComm() [1/2]

mdwc::CMidLinkComm * mdwc::MidLinkBase::GetMidLinkComm ( const std::string & sOperate)

从连接池取得连接

参数
sOperate用途描述
返回
成功,返回通信连接对象,失败返回nullptr
函数调用图:
这是这个函数的调用关系图:

◆ GetMidLinkComm() [2/2]

mdwc::CMidLinkComm * mdwc::MidLinkBase::GetMidLinkComm ( const std::string & sOperate,
const std::string & sIPAdress,
short iCommPort,
int iTimeOut = 30,
const std::string & sTokenID = "" )

从连接池取得通信连接

参数
sOperate用途描述
sIPAdress中间件服务器IP地址
iCommPort中间件服务器通信端口
iTimeOut通信超时值,单位:秒
sTokenID连接令牌,用于连接中间件服务器,默认为空值
返回
成功,返回通信连接对象,失败返回nullptr
函数调用图:

◆ GetMidLinkCommPoolStatus()

std::vector< std::string > mdwc::MidLinkBase::GetMidLinkCommPoolStatus ( )

获取连接池状态信息

返回
返回连接列表
这是这个函数的调用关系图:

◆ GetShowedMessage()

int mdwc::MidLinkBase::GetShowedMessage ( mdwc::NET_MESSAGE & retmsg)

取得短消息

参数
retmsg短信消息结构
返回
0没有消息,1成功取得,2表示还有后续记录没有获取,<0为错误代码

◆ GetTxmmKey()

int mdwc::MidLinkBase::GetTxmmKey ( )
inline

取得通信加密Key值

◆ Inited()

bool mdwc::MidLinkBase::Inited ( )
inline

是否初始化成功.

返回
返回初始化是否成功

◆ Initialize()

mdwc::MidLinkBase * mdwc::MidLinkBase::Initialize ( const std::string & sProductName,
const std::string & sVersion,
const std::string & sWorkDirectory = "",
MidCharSet eDefaultChatSet = MidCharSet::AUTO,
int iAutoRecycleCommObjectWaitTimes = 120 )
static

Mid_Link通信接口基类初始化.

参数
sProductNameRDMS注册的产品名称
sVersionRDMS注册的产品版本
sWorkDirectory工作目录,为空则取当前目录
eDefaultChatSet设置数据传输使用的字符集,默认使用当前连接的中间件字符集,减少数据转换带来的开销
iAutoRecycleCommObjectWaitTimes自动回收空闲通信连接的时间,单位秒,为<60不回收
返回
成功返回实例指针,失败返回nullptr
函数调用图:

◆ OpenMidLinkComm() [1/2]

bool mdwc::MidLinkBase::OpenMidLinkComm ( const std::string & sConfigFile = "",
bool bConnectedServer = true )

初始化通信接口库.

参数
sConfigFile配置文件名称
bConnectedServer是否创建与服务器的连接
返回
成功、失败
函数调用图:

◆ OpenMidLinkComm() [2/2]

bool mdwc::MidLinkBase::OpenMidLinkComm ( const std::string & sIPAdress,
int iCommPort,
int iTimeOut,
const std::string & sTokenID = "" )

使用指定的服务器IP地址和端口初始化通信接口库.

参数
sIPAdress中间件服务器IP地址
iCommPort中间件服务器通信端口
iTimeOut通信超时值,单位:秒
sTokenID连接令牌,用于连接中间件服务器,默认为空值
返回
成功、失败
函数调用图:
这是这个函数的调用关系图:

◆ ReceiveMulticastFile()

bool mdwc::MidLinkBase::ReceiveMulticastFile ( bool bEnabled,
const std::string & sFileType = "*" )

启用接收多点传送文件的功能

参数
bEnabledtrue启动,false停止
sFileType要接收的文件类型标识,自定义
返回
true启动或停止服务成功

◆ RecycleMidLinkComm()

void mdwc::MidLinkBase::RecycleMidLinkComm ( int iFreeTime)

回收长时间占用的空闲连接池资源

参数
iFreeTime空闲时间:秒
这是这个函数的调用关系图:

◆ RegisterRDMS()

int mdwc::MidLinkBase::RegisterRDMS ( int iConnectNo,
std::string sClientID,
unsigned short wPort,
bool bLogOut,
bool bPMPMode )

在中间件服务器注册客户端机参数

参数
iConnectNo通信连接号, 如果为零所有的中间件节点都注册
sClientID客户端标识客户端标识
wPort本地服务端口
bLogOut注销
bPMPMode反向代理模式
返回
返回0成功,<0为错误代码

◆ RegisterUser()

int mdwc::MidLinkBase::RegisterUser ( std::string UserCode,
std::string UserName )

在网络上注册当前登录的用户信息,主要用于在各用户之间发送短消息

参数
UserCode登录到系统的用户代码
UserName登录到系统的用户名称
返回
-1:没有调用InitComm函数; -2:组播连接错误; 0:注册成功;

◆ ReleaseMidLinkComm()

void mdwc::MidLinkBase::ReleaseMidLinkComm ( mdwc::CMidLinkComm * comm,
bool bRemove = false )

将连接返回给连接池

参数
comm通信连接实例
bRemovetrue从连接池中移除,关闭通信连接,并释放连接对象,false不关闭通信连接
函数调用图:
这是这个函数的调用关系图:

◆ SendNetMessage()

bool mdwc::MidLinkBase::SendNetMessage ( mdwc::MSG_TYPE eMsgType,
std::string sMsgContext )

组播发送业务消息,需要业务系统解析消息内容

参数
eMsgType消息类型
sMsgContext消息内容
返回
true 发送成功

◆ SendTextMessage()

int mdwc::MidLinkBase::SendTextMessage ( std::string sReceives,
std::string sMsgContext,
std::string sSended )

组播文字通信发送消息

参数
sReceives消息接收者,ALL表示广播发送
sMsgContext消息内容
sSended发送者
返回

◆ SetCommCharSet()

bool mdwc::MidLinkBase::SetCommCharSet ( MidCharSet eCharSetID)

设置客户端应用程序字符集.

参数
eCharSetID默认0–GBK(936) 1–GB18030(54936) 2–UTF-8(65001) /returns成功、失败

◆ UnInitialize()

void mdwc::MidLinkBase::UnInitialize ( )
static

反向初始化,关闭所有通信连接,并释放资源

◆ UnRegisterUser()

int mdwc::MidLinkBase::UnRegisterUser ( )

取消用户注册

返回

类成员变量说明

◆ MDWLogger

std::unique_ptr<CMDWLogger> mdwc::MidLinkBase::MDWLogger

MDWClient内部日志处理

◆ MidLinkDLL

std::unique_ptr<CMidLinkDLL> mdwc::MidLinkBase::MidLinkDLL

Mid_Link动态链接库引用

◆ MidLinkMessage

std::unique_ptr<CMidLinkMessage> mdwc::MidLinkBase::MidLinkMessage

本地通信服务端基类

◆ MidLinkServer

std::unique_ptr<CMidLinkServer> mdwc::MidLinkBase::MidLinkServer

通信库消息处理线程

◆ RDMSLogHelper

std::unique_ptr<CRDMSLogHelper> mdwc::MidLinkBase::RDMSLogHelper

上传到RDMS信息管理类


该类的文档由以下文件生成:
  • E:/GreatMIMP.Linux.Client/MDWClient/MidLinkBase.h
  • E:/GreatMIMP.Linux.Client/MDWClient/MidLinkBase.cpp