关于用.Net平台开发SPMS_API开发接口里的PChar说明——转载

SPInterface.dll

上行接收函数: GetCNGPDeliverSM

问题说明: 此开发包为Delphi6开发,其中用了PChar这种Vb和.Net不直接支持的数据类型,需要一定的转换.

下面为VB.Net 2005开发代码示例:

定义部份:

Imports System.Runtime.InteropServices

Private Declare Function GetCNGPDeliverSM Lib "SP_Interface.dll" ( _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sMsgID As String, _
   ByRef byMsgFormat As Byte, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sRecvTime As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sOrgAddr As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sDestAddr As String, _
   ByRef byMsgLen As Byte, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sMsgContent As String, _
   ByRef byProValue As Byte, _
   ByRef byIsReport As Byte, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sSrcMsgID As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sSubmitdate As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sDonedate As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef sStatus As String, _
   ByRef iDeliverAckResult As Int32, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef Link_ID As String, _
   <MarshalAs(UnmanagedType.VBByRefStr)> ByRef BeneficiaryID As String) As Int32

初台化各指针

Public Sub XX()

Dim Result As Int32
Dim sMsgID As New String(Chr(0), 10)
Dim byMsgFormat As Byte = 0
Dim sRecvTime As New String(Chr(0), 14)
Dim sOrgAddr As New String(Chr(0), 20)
Dim sDestAddr As New String(Chr(0), 20)
Dim byMsgLen As Byte = 0
Dim sMsgContent As New String(Chr(0), 254)
Dim byProValue As Byte = 0
Dim byIsReport As Byte = 0
Dim sSrcMsgID As New String(Chr(0), 20)
Dim sSubmitdate As New String(Chr(0), 10)
Dim sDonedate As New String(Chr(0), 10)
Dim sStatus As New String(Chr(0), 7)
Dim iDeliverAckResult As Byte = 0
Dim Link_ID As New String(Chr(0), 20)
Dim BeneficiaryID As New String(Chr(0), 21)

End Sub

详细说明:

在下行的时候虽说传入参数也有PChar类型,不过用String类型可以表示并系统可以识别,不需要我们自己去转换,其它类型的可按开发文档上的Byte和Int32类型表示

上行因为PChar是指针引用,象ByRef或Output这种按引用传值方式,所以需要托管代码到非托管代码的一个指针转换,那么可以使用UnmanagedType.VBByRefStr 进行"特性"说明这一转换,C#也一样,好象.Net1.1不支持这一项,我也没研究过

除了这一项之外还有就是必须分配内存空间,这里我用New String(Chr(0),100)表示,后面的100是字符长度,这个是定长.

 
目 录 1 前言 1 2 USE概述 2 2.1服务部件 4 2.2统计数据库说明 5 2.3开发接口 5 2.4实用工具 6 3 USE开发指南 8 3.1 坐席软电话开发说明 8 3.1.1 API开发 10 long USE_ConnectToAgent 12 long USE_DisconnectAgent 13 long USE_Login 14 long USE_LoginEx 16 long USE_Logout 17 long USE_ SetAgentStatus 18 long USE_GetAgentEvent 19 long USE_ForceLogout 23 long USE_SendMsgToAgent 24 long USE_BroadMsgToAll 25 long USE_BroadMsgToAgentGroup 26 long USE_GetAgentStatus 27 long USE_GetAgentDNByID 29 long USE_GetAgentIDByDN 30 long USE_ConnectTelBaseServer 31 long USE_DisconnectFromTelBaseServer 32 long USE_GetAssociateData 33 long USE_SetAssociateData 35 long USE_AnswerCall 37 long USE_DisconnectCall 38 long USE_HoldCall 39 long USE_RetrieveHeld 40 long USE_ConsultCall 41 long USE_ConferenceCall 43 long USE_TransferCall 44 long USE_ReconnectHeld 45 long USE_MakeCall 46 long USE_SingleStepTransfer 47 long USE_SingleStepConference 48 long USE_GetDeviceState 49 long USE_ConnectToRouter 51 long USE_DisconnectFromRouter 52 long USE_GetSrvRoutePoint 53 long USE_SetService 54 long USE_GetServiceData 56 long USE_ReqVirtualRoute 58 long USE_GetRouteTarget 59 long USE_RegOutboundSrv 61 long USE_GetAllSrvRes 62 long USE_WithdrawPreLock 63 long USE_WithdrawVirtualRoute 64 long USE_GetResourceCount 65 long USE_GetResourceDetail 66 long USE_SetServiceEx 68 long USE_GetSrvDescByContact 69 int TV_Installed 71 int TV_Initialize 71 Void TV_Disable 72 Void TV_HangUpCtrl 72 Void TV_OffHookCtrl 73 int TV_StartDial 73 Void TV_FlushDTMF 74 int TV_GetDTMFChar 75 Void TV_ConnectChannels 75 Void TV_DisconnectChannels 76 Void TV_ConnectTo 76 long TV_StartRecordFile 77 long TV_StartPlayFile 77 long TV_PlayFileRest 78 long TV_StopPlayFile 78 3.1.2 USE_AgentBar OCX层开发 79 3.1.2.1 USE_AgentBar控件说明 79 3.1.2.2 USE_AgentBar控件属性 82 3.1.2.3 USE_AgentBar方法 85 3.1.2.4 USE_AgentBar事件 124 3.2 USE_Monitor OCX开发 133 3.2.1 USE_Monitor控件概述 133 3.2.2 USE_Monitor方法说明 133 long Init( ) 133 long Stop( ) 134 long GetFirstService( ) 135 long GetNextService( ) 137 bool IsLastService ( ) 138 long GetServiceStatistic( ) 139 long GetAllServiceStatistic( ) 142 long GetAgentStatusByID( ) 144 long GetFirstAgentByService( ) 145 long GetNextAgentByService( ) 147 bool IsLastAgent ( ) 148 long GetDeviceStatusByID( ) 149 long GetFirstDeviceByService( ) 150 long GetNextDeviceByService( ) 151 bool IsLastDevice( ) 152 long GetFirstTrunkGroup( ) 153 long GetNextTrunkGroup( ) 154 bool IsLastTrunkGroup( ) 155 bool IsAgentResource( ) 156 long GetTrunkGroupStatistic( ) 157 long GetaAllTrunkGroupStatistic() 158 long BroadcastMsgToServiceGroup() 159 long BroadcastToAll() 160 long SendMsgToAgent() 161 long ForceLogout( ) 162 3.3 IVR接口开发 163 3.3.1 接口数据类型 163 3.3.2 接口函数定义 164 USE_Result USE_SetAssociateData() 164 USE_Result USE_GetAssociateData() 166 USE_Result USE_MakeService() 168 USE_Result USE_RequestService() 169 USE_Result USE_ReqOutboundSrv() 171 USE_Result USE_ReqPreLockSrv() 172 USE_Result USE_WithdrawPreLock() 173 USE_Result USE_GetServiceInfo() 174 3.3.3 COM组件发布 176 COMUSE_MakeServiceVoiceMail 176 3.4 统计报表开发 177 3.4.1 概述 177 3.4.2 基础数据表 177 3.4.2.1 坐席登录日志表 (Tbl_Agent_Log) 177 3.4.2.2 坐席工作状态明细表(Tbl_Agent_Status) 179 3.4.2.3 资源服务信息表(Tbl_Res_Working) 180 3.4.2.4 资源协作服务信息表(Tbl_Res_Coorporation) 182 3.4.2.5 服务单元详细信息表(Tbl_SrvUnit) 183 3.4.2.6 呼叫基础信息表(Tbl_Contact_Base) 184 3.4.3 服务明细数据视图 187 3.4.3.1 服务单元明细视图(View_SrvUnit_Detail) 187 3.4.3.2 资源受理服务明细视图(View_Res_Working) 189 3.4.3.3 资源协作服务明细视图(View_Res_Coorporation) 191 3.4.3.4 坐席工作状态明细视图(View_Agent_Status) 192 3.4.3.5 中继组状态明细视图(View_TrunkGroup_Status) 193 3.4.3.6 系统呼叫明细视图(View_Contact_Data) 194 3.4.4 统计数据表和视图 195 3.4.4.1 服务统计表(未定义) 195 3.4.4.2 呼叫流量表(时、日、月) 195 3.4.4.3 服务单元统计表(时、日、月) 196 3.4.4.4 坐席受理服务统计表(时、日、月) 198 3.4.4.5 设备资源服务统计表(时、日、月) 200 3.4.4.6 坐席工作统计表(时、日、月) 202 3.4.4.7 坐席工作日志表 203 附录: 204 附录A:统计开发特殊域说明 204 附录B:统计开发特殊概念的说明 206 附录C:常用错误代码对照表 207 附录D:坐席状态迁移图 211 附录F:转移方法与状态关系表 212
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值