-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
101 changed files
with
5,847 additions
and
699 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#ifndef __CITICS_HSHLP_H__ | ||
#define __CITICS_HSHLP_H__ | ||
|
||
#ifdef WIN32 | ||
#ifdef CITICS_HSHLP_EXPORTS | ||
#define CITICS_HSHLP_API __declspec(dllexport) | ||
#else | ||
#define CITICS_HSHLP_API __declspec(dllimport) | ||
#endif | ||
|
||
#define CITICSSTDCALL __stdcall /* ensure stcall calling convention on NT */ | ||
#else | ||
#define CITICS_HSHLP_API | ||
#define CITICSSTDCALL /* leave blank for other systems */ | ||
#endif | ||
|
||
#define ERROR_MSG_SIZE 512 | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* 同步业务调用 | ||
* 使用该标识调用业务时,系统处于阻塞状态直到返回应答信息或超时 | ||
*/ | ||
#define BIZCALL_SYNC 0 | ||
|
||
/** | ||
* 异步业务调用 | ||
* 使用该标识调用业务时,系统立即返回而不等待应答信息。 | ||
* 需要调用QueueGetMsg获取应答结果信息 | ||
*/ | ||
#define BIZCALL_ASYNC 1 | ||
|
||
/** | ||
* 订阅消息中心发布的消息信息 | ||
* 标识该业务为消息订阅请求。如订阅成交推送数据、系统通知消息等 | ||
* 需要调用QueueGetMsg获取订阅的信息 | ||
*/ | ||
#define BIZCALL_SUBSCRIBE 3 | ||
|
||
typedef void *HSHLPCFGHANDLE; | ||
typedef void *HSHLPHANDLE; | ||
typedef void *HSHLPASYNCMSG; | ||
|
||
#pragma pack(1) | ||
|
||
/* 异步和订阅消息控制信息*/ | ||
typedef struct | ||
{ | ||
int nFlags; // 位标识信息,0x0:正常消息, >0:系统状态消息 | ||
int nFuncID; // 异步请求功能号 | ||
int nReqNo; // 异步请求接受序号,根据该序号和功能号对请求和应答数据匹配 | ||
int nIssueType; // 发布消息类别 | ||
int nErrorNo; // 错误代码 | ||
HSHLPASYNCMSG HAsyncMsg; // 消息句柄 | ||
char szErrorInfo[ERROR_MSG_SIZE+1]; // 错误信息 | ||
}MSG_CTRL, *LPMSG_CTRL; | ||
|
||
#pragma pack() | ||
|
||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
// 初始化配置项,szConfigFile为空时则按系统默认值初始化,hConfig为出参 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_InitConfig(HSHLPCFGHANDLE* hConfig, const char* szConfigFile=NULL); | ||
|
||
// 加载配置文件项,可以加载多个不同的配置文件,返回不同的配置句柄。等同于InitConfig | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_LoadConfig(HSHLPCFGHANDLE* hConfig, const char* szConfigFile); | ||
|
||
// 重置服务器连接地址。格式:ip1:port1;ip2:port2; | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_ResetServer(HSHLPCFGHANDLE hConfig, const char* szAddr); | ||
|
||
// 根据配置句柄,初始化一个连接对象。 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_Init(HSHLPHANDLE* HlpHandle, HSHLPCFGHANDLE hConfig); | ||
// 释放连接句柄系统资源 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_Exit(HSHLPHANDLE HlpHandle); | ||
|
||
// 与服务器建立连接 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_ConnectServer(HSHLPHANDLE HlpHandle); | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_DisConnect(HSHLPHANDLE HlpHandle); | ||
|
||
// 提交业务请求,如果szParam参数为NULL,则认为是通过SetValue函数设置的请求参数 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_BizCallAndCommit(HSHLPHANDLE HlpHandle, int iFuncID, const char* szParam=NULL, int nBizCallType=BIZCALL_SYNC, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 获取记录行、列数,返回值为行、列数 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetRowCount(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL); | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetColCount(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 获取字段名称,序号以0为基数 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetColName(HSHLPHANDLE HlpHandle, int iColumn, char* szColName, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 获取下一行记录,第一次调用则首先打开结果集,并把第0行作为当前记录行 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetNextRow(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 根据字段名称,获取字段值 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetValue(HSHLPHANDLE HlpHandle, const char* szKeyName, char* szValue, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 根据字段序号获取字段值,序号以0为基数 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetValueByIndex(HSHLPHANDLE HlpHandle, int iColumn, char* szValue, LPMSG_CTRL lpMsgCtrl=NULL); | ||
|
||
// 获取当前错误代码和信息 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetErrorMsg(HSHLPHANDLE HlpHandle, int* piErrorCode, char* szErrorMsg); | ||
|
||
|
||
/************************************************************************/ | ||
// 另一种请求参数设置的方法,一个一个的设置。 | ||
// 初始化请求参数 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_BeginParam(HSHLPHANDLE HlpHandle); | ||
// 设置每个请求参数字段名称和值 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_SetValue(HSHLPHANDLE HlpHandle, const char* szKeyName, const char* szValue); | ||
|
||
|
||
/************************************************************************/ | ||
// 异步请求和消息订阅相关函数 | ||
|
||
// 获取异步消息队列中的消息数量 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueMsgCount(HSHLPHANDLE HlpHandle); | ||
|
||
// 从队列中读取一条消息,如果队列中没有数据,该函数会一直阻塞不返回,直到nWaitTime超时时间后才返回。 | ||
// nWaitTime: 单位毫秒 | ||
// = 0: 立即返回;如果队列中有数据则返回Msg,且return值为 0,否则return值为-5(超时错误) | ||
// =-1: 阻塞,直到队列中有数据获取到Msg 才返回。否则将永久阻塞等待。return值为 0, | ||
// = 其它值:超时时间,如果队列中有数据则立即返回,否则等待time时间后返回。return值为 -5(超时错误)。 | ||
// Return: 0: 队列中有数据且获取消息成功; | ||
// -5: 超时错误,在设定的时间内队列中没有数据。 | ||
// 其它错误: | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueGetMsg(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl /*Out*/, int nWaitTime=0); | ||
|
||
// 处理完成或者不需要该消息时,应及时删除该消息,否则消息将占用大量内存。 | ||
// 如果不删除有可能每次都Get到同一条消息 | ||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueEraseMsg(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl /*In*/); | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
||
#endif |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[t2sdk] | ||
; 客户端要连接的服务端的IP和端口,可以配置一个或多个,中间以;分割,连接初始化时,会从这串服务端地址中,随即选择一个作为要建立连接的服务端 | ||
servers=114.251.228.136:20008 | ||
; 接收缓存的初始大小,单位字节,实际接收到服务端的数据时,可能会扩大(如果需要) | ||
init_recv_buf_size=512 | ||
|
||
; 每块发送缓存的初始大小,单位字节,该大小也会根据需要动态扩大 | ||
init_send_buf_size=512 | ||
|
||
; 发送队列的大小,该大小不会动态变化,若该配置项很小,且连接发包很频繁,则可能 | ||
; 因为发送队列满而造成发送失败 | ||
send_queue_size=1000 | ||
|
||
; lang用于指定T2_SDK错误信息的语言ID(2052为简体中文,1033为英文) | ||
; 默认为2052 | ||
lang=2052 | ||
|
||
; 此配置项请参看“注意事项” | ||
event_count=10 | ||
|
||
; 许可证文件的路径,默认为当前目录下的license.dat。 | ||
license_file=./license.dat | ||
|
||
|
||
[proxy] | ||
; 可配置采用何种代理配置http/socks4/socks5,空表示不采用代理 | ||
proxy_type= | ||
|
||
; 代理服务器的IP地址 | ||
ip= | ||
port= | ||
|
||
; 登陆代理服务器的用户名 | ||
user_name=guest | ||
password= | ||
|
||
[safe] | ||
; 连接的安全模式,明文(none),通信密码(pwd),SSL(ssl) | ||
; 注意大小写敏感 | ||
safe_level=none | ||
|
||
; 当连接的安全模式为pwd时,client_id配置项才生效 | ||
client_id= | ||
|
||
; 在pwd模式下,当client_id为空时,comm_pwd为默认的密钥 | ||
; 注意当client_id为空时,comm_pwd必须和服务端的配置一致方可正常使用,目前服务 | ||
; 端的配置为888888 | ||
comm_pwd=888888 | ||
|
||
; 当连接的安全模式为ssl时,cert_file和cert_pwd配置项才生效 | ||
; 证书文件路径 | ||
cert_file=xxx.pem | ||
cert_pwd=xxxxxxxx |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
[t2sdk] | ||
#第三方许可证 | ||
license_file= | ||
servers=192.168.94.85:8001 | ||
login_name= | ||
init_recv_buf_size=512 | ||
init_send_buf_size=512 | ||
send_queue_size=1000 | ||
#心跳时间 | ||
heartbeat_time=10 | ||
#接入用户密码 | ||
license_pwd= | ||
|
||
[safe] | ||
safe_level=ssl | ||
#SSL证书 | ||
cert_file= | ||
#SSL证书密码 | ||
cert_pwd= |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[t2sdk] | ||
; 客户端要连接的服务端的IP和端口,可以配置一个或多个,中间以;分割,连接初始化时,会从这串服务端地址中,随即选择一个作为要建立连接的服务端 | ||
servers=114.251.228.136:20008 | ||
; 接收缓存的初始大小,单位字节,实际接收到服务端的数据时,可能会扩大(如果需要) | ||
init_recv_buf_size=512 | ||
|
||
; 每块发送缓存的初始大小,单位字节,该大小也会根据需要动态扩大 | ||
init_send_buf_size=512 | ||
|
||
; 发送队列的大小,该大小不会动态变化,若该配置项很小,且连接发包很频繁,则可能 | ||
; 因为发送队列满而造成发送失败 | ||
send_queue_size=1000 | ||
|
||
; lang用于指定T2_SDK错误信息的语言ID(2052为简体中文,1033为英文) | ||
; 默认为2052 | ||
lang=2052 | ||
|
||
; 此配置项请参看“注意事项” | ||
event_count=10 | ||
|
||
; 许可证文件的路径,默认为当前目录下的license.dat。 | ||
license_file=./license.dat | ||
|
||
|
||
[proxy] | ||
; 可配置采用何种代理配置http/socks4/socks5,空表示不采用代理 | ||
proxy_type= | ||
|
||
; 代理服务器的IP地址 | ||
ip= | ||
port= | ||
|
||
; 登陆代理服务器的用户名 | ||
user_name=guest | ||
password= | ||
|
||
[safe] | ||
; 连接的安全模式,明文(none),通信密码(pwd),SSL(ssl) | ||
; 注意大小写敏感 | ||
safe_level=none | ||
|
||
; 当连接的安全模式为pwd时,client_id配置项才生效 | ||
client_id= | ||
|
||
; 在pwd模式下,当client_id为空时,comm_pwd为默认的密钥 | ||
; 注意当client_id为空时,comm_pwd必须和服务端的配置一致方可正常使用,目前服务 | ||
; 端的配置为888888 | ||
comm_pwd=888888 | ||
|
||
; 当连接的安全模式为ssl时,cert_file和cert_pwd配置项才生效 | ||
; 证书文件路径 | ||
cert_file=xxx.pem | ||
cert_pwd=xxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[auth_info] | ||
ProfileCode=af2ebd99da3c6636171ea72747a5e32d | ||
LimitDate=20300101 | ||
AllowPushTransation=0 | ||
AllowWbp=0 | ||
AuthCode=AQAAAABo23AyYmI1MWQ2ZGFhN2ExMjI1OTQyODgzZjA2OWFhNDBmOQAAAAAAAAAAAAAAAA== | ||
[functions] | ||
func= | ||
;[ProcessInfo_0] | ||
;ProcessName=HsT2Hlp_Demo.exe,Hs.exe | ||
;NetIP=172.23.123.9 | ||
;NetMask=255.255.255.0 | ||
;[ProcessInfo_0] | ||
;ProcessName=Option_Demo.exe | ||
;NetIP=10.0.0.0 | ||
;NetMask=255.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
2015-03-31 14:15:01.664: --Get This machine ID��203��failed�� | ||
2015-03-31 14:17:40.303: --Get This machine ID��203��failed�� | ||
2015-03-31 14:20:04.287: --Get This machine ID��203��failed�� | ||
2015-03-31 14:20:19.251: --Get This machine ID��203��failed�� | ||
20150331 14:39:57.407 1: [h034fd2a0/t334c] the Connection has been disconnected. | ||
2015-03-31 14:44:13.047: --Get This machine ID��203��failed�� | ||
2015-03-31 15:34:12.591: --Get This machine ID��203��failed�� | ||
2015-04-01 10:33:25.959: --Get This machine ID��203��failed�� | ||
2015-04-01 13:39:17.232: --Get This machine ID��203��failed�� | ||
2015-04-01 13:44:00.590: --Get This machine ID��203��failed�� | ||
2015-04-01 13:44:54.336: --Get This machine ID��203��failed�� | ||
2015-04-01 13:45:17.417: --Get This machine ID��203��failed�� | ||
20150401 13:48:50.439 1: [h04557720/t3530] the Connection has been disconnected. | ||
20150401 13:49:13.822 1: [h045f7720/t317c] the Connection has been disconnected. | ||
20150401 14:34:59.175 1: [h045a7720/t2f80] the Connection has been disconnected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# encoding: UTF-8 | ||
|
||
import sys | ||
from time import sleep | ||
|
||
from PyQt4 import QtGui | ||
|
||
from vncshshlp import * | ||
|
||
#---------------------------------------------------------------------- | ||
def print_dict(d): | ||
"""按照键值打印一个字典""" | ||
for key,value in d.items(): | ||
print key + ':' + str(value) | ||
|
||
|
||
#---------------------------------------------------------------------- | ||
def simple_log(func): | ||
"""简单装饰器用于输出函数名""" | ||
def wrapper(*args, **kw): | ||
print "" | ||
print str(func.__name__) | ||
return func(*args, **kw) | ||
return wrapper | ||
|
||
|
||
class TestHlp(CsHsHlp): | ||
#---------------------------------------------------------------------- | ||
def __init__(self): | ||
"""""" | ||
super(TestHlp, self).__init__() | ||
|
||
#---------------------------------------------------------------------- | ||
@simple_log | ||
def onMsg(self, data): | ||
"""""" | ||
print_dict(data) | ||
|
||
|
||
#---------------------------------------------------------------------- | ||
def test(): | ||
"""测试用""" | ||
api = TestHlp() | ||
|
||
# 读取配置文件 | ||
print api.loadConfig("Hsconfig.ini") | ||
|
||
# 初始化 | ||
print api.init() | ||
|
||
# 连接服务器 | ||
print api.connectServer() | ||
|
||
|
||
if __name__ == '__main__': | ||
test() |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
[t2sdk] | ||
#第三方许可证 | ||
license_file= | ||
servers=192.168.94.85:8001 | ||
login_name= | ||
init_recv_buf_size=512 | ||
init_send_buf_size=512 | ||
send_queue_size=1000 | ||
#心跳时间 | ||
heartbeat_time=10 | ||
#接入用户密码 | ||
license_pwd= | ||
|
||
[safe] | ||
safe_level=ssl | ||
#SSL证书 | ||
cert_file= | ||
#SSL证书密码 | ||
cert_pwd= |
Binary file not shown.
Oops, something went wrong.