You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

622 lines
20 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Net;
namespace RemoteObjects
{
/*
*struParam
*
*2010-10-30
*remoting
*/
class struParam
{
public string sMID;//仪表ID
public List<uint> lstParams;//参数列表
public object oParam; //参数对象
}
/*
*ReqHandler
*
*2010-10-30
*remoting
*/
public class ReqHandler : MarshalByRefObject
{
/*
*SetTime
*
*2010-10-30
*string sTName ID
*bool true false
*(
*/
public bool SetTime(string sTName)
{
bool res = false;
//类型编号
int nFID = 0;
//终端编号
//sTName
//参数打包
//
object resp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref resp);
return res;
}
/*
*GetTime
*
*2010-10-30
*string sTName ID, ref string sTime
*bool true false
*
*/
public bool GetTime(string sTName, ref string sTime)
{
bool res = false;
//类型编号
int nFID = 1;
//终端编号
//sTName
//参数打包
//
object oTime = sTime;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oTime);
sTime = (string)oTime;
return res;
}
/*
*GetAutoSendInterval
*
*2010-10-30
*string sTName ID, ref string sInterval
*bool true false
*
*/
public bool GetAutoSendInterval(string sTName, ref string sInterval)
{
bool res = false;
//类型编号
int nFID = 6;
//终端编号
//sTName
//参数打包
//
object oInterval = sInterval;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oInterval);
sInterval = (string)oInterval;
return res;
}
/*
*GetHeartBeatInterval
*
*2010-10-30
*string sTName ID, ref string sInterval
*bool true false
*
*/
public bool GetHeartBeatInterval(string sTName, ref string sInterval)
{
bool res = false;
//类型编号
int nFID = 7;
//终端编号
//sTName
//参数打包
//
object oInterval = sInterval;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oInterval);
sInterval = (string)oInterval;
return res;
}
/*
*GetData
*
*2010-10-30
*string sTName ID,
*string sMID ID,
*List<uint> lstParams ID,
*ref Hashtable htRes
*bool true false
*
*/
public bool GetData(string sTName, string sMID, List<uint> lstParams, ref Hashtable htRes)
{
bool res = false;
//类型编号
int nFID = 3;
//终端编号
//sTName
//参数打包
struParam param = new struParam();
param.sMID = sMID;
param.lstParams = lstParams;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, param, ref oResp);
htRes = (Hashtable)oResp;
return res;
}
/*
*SetHeartBeatInterval
*
*2010-10-30
*string sTName ID, int nMnts
*bool true false
*
*/
public bool SetHeartBeatInterval(string sTName, int nMnts)
{
bool res = false;
//类型编号
int nFID = 5;
//终端编号
//sTName
//参数打包
byte byInterval;
byInterval = (byte)nMnts;//100
Hashtable htParams = new Hashtable();
htParams.Add("DB41", byInterval);
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, htParams, ref oResp);
return res;
}
/*
*SetHeartBeatInterval
*
*2010-10-30
*string sTName ID, int nMnts
*bool true false
*
*/
public bool SetSteamFailInterval(string sTName, int nMnts)
{
bool res = false;
//类型编号
int nFID = 21;
//终端编号
//sTName
//参数打包
byte byInterval;
byInterval = (byte)nMnts;//100
Hashtable htParams = new Hashtable();
htParams.Add("DB44", byInterval);
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, htParams, ref oResp);
return res;
}
/*
*SetAutoSendInterval
*
*2010-10-30
*string sTName ID, int nMnts
*bool true false
*
*/
public bool SetAutoSendInterval(string sTName, int nMnts)
{
bool res = false;
//类型编号
int nFID = 4;
//终端编号
//sTName
//参数打包
byte byInterval;
byInterval = (byte)nMnts;//100
Hashtable htParams = new Hashtable();
htParams.Add("DB42", byInterval);
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, htParams, ref oResp);
return res;
}
/*
*SetIPPort
*
*2010-10-30
*string sTName ID, string sIP IP, int nPort
*bool true false
*IP
*/
public bool SetIPPort(string sTName, string sIP, int nPort)
{
bool res = false;
//类型编号
int nFID = 2;
//终端编号
//sTName
//参数打包
IPAddress address = IPAddress.Parse(sIP);
byte[] byIPPort = new byte[6];
address.GetAddressBytes().CopyTo(byIPPort, 0);
byIPPort[4] = (byte)(nPort/256);//100
byIPPort[5] = (byte)(nPort % 256);//100
Hashtable htParams = new Hashtable();
htParams.Add("8010", byIPPort);
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, htParams, ref oResp);
return res;
}
/*
*SetServerIPPort
*
*2010-10-30
*string sTName ID, string sIP IP, int nPort
*bool true false
*IP
*/
public bool SetServerIPPort(string sTName, string sIP, int nPort)
{
bool res = false;
//类型编号
int nFID = 18;
//终端编号
//sTName
//参数打包
IPAddress address = IPAddress.Parse(sIP);
byte[] byIPPort = new byte[6];
address.GetAddressBytes().CopyTo(byIPPort, 0);
byIPPort[4] = (byte)(nPort / 256);//0x100
byIPPort[5] = (byte)(nPort % 256);//0x100
Hashtable htParams = new Hashtable();
htParams.Add("801A", byIPPort);
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, htParams, ref oResp);
return res;
}
/*
*GetTerminalList
*
*2010-10-30
*ref Hashtable htTerminal
*bool true false
*
*/
public bool GetTerminalList(ref Hashtable htTerminal)
{
bool res = false;
res = CommService.Common.platForm.tcpServer.GetTerminalList(htTerminal);
return res;
}
/*
*SetTerminalName
*
*2010-10-30
*string sTName ID, string sNewName ID
*bool true false
*ID
*/
public bool SetTerminalName(string sTName, string sNewName)
{
bool res = false;
//类型编号
int nFID = 8;
//终端编号
//sTName
//参数打包
//
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, sNewName, ref oResp);
return res;
}
/*
*SetMeterAddr
*
*2010-10-30
*string sTName ID, ref byte[] arrAddr
*bool true false
*ID
*/
public bool SetMeterAddr(string sTName, ref byte[] arrAddr)
{
bool res = false;
//类型编号
int nFID = 9;
//终端编号
//sTName
//参数打包
//struParam param = new struParam();
//param.sMID = sMID;
//param.lstParams = lstParams;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, arrAddr, ref oResp);
//htRes = (Hashtable)oResp;
return res;
}
/*
*GetMeterAddr
*
*2010-10-30
*string sTName ID, ref byte[] arrAddr
*bool true false
*ID
*/
public bool GetMeterAddr(string sTName, ref byte[] arrAddr)
{//10
bool res = false;
//类型编号
int nFID = 10;
//终端编号
//sTName
//参数打包
//struParam param = new struParam();
//param.sMID = sMID;
//param.lstParams = lstParams;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oResp);
arrAddr = (byte[])oResp;
return res;
}
/*
*SetMeterAble
*
*2010-10-30
*string sTName ID, ref byte[] arrAddr
*bool true false
*
*/
public bool SetMeterAble(string sTName, ref byte[] arrAddr)
{//11
bool res = false;
//类型编号
int nFID = 11;
//终端编号
//sTName
//参数打包
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, arrAddr, ref oResp);
//htRes = (Hashtable)oResp;
return res;
}
/*
*GetMeterAble
*
*2010-10-30
*string sTName ID, ref byte[] arrAddr
*bool true false
*
*/
public bool GetMeterAble(string sTName, ref byte[] arrAddr)
{//12
bool res = false;
//类型编号
int nFID = 12;
//终端编号
//sTName
//参数打包
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oResp);
arrAddr = (byte[])oResp;
return res;
}
/*
*SetStreamThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool SetStreamThreshold(string sTName, string sMID, ref string[] arrThreshold)
{
bool res = false;
//类型编号
int nFID = 13;
//终端编号
//sTName
//参数打包
struParam param = new struParam();
param.sMID = sMID;
param.oParam = arrThreshold;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, param, ref oResp);
//htRes = (Hashtable)oResp;
return res;
}
/*
*GetStreamThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool GetStreamThreshold(string sTName, string sMID, ref string[] arrThreshold)
{
bool res = false;
//类型编号
int nFID = 14;
//终端编号
//sTName
//参数打包
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, sMID, ref oResp);
arrThreshold = (string[])oResp;
return res;
}
/*
*SetElectricThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool SetElectricThreshold(string sTName, string sMID, ref string[] arrThreshold)
{
bool res = false;
//类型编号
int nFID = 15;
//终端编号
//sTName
//参数打包
struParam param = new struParam();
param.sMID = sMID;
param.oParam = arrThreshold;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, param, ref oResp);
//htRes = (Hashtable)oResp;
return res;
}
/*
*GetElectricThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool GetElectricThreshold(string sTName, string sMID, ref string[] arrThreshold)
{
bool res = false;
//类型编号
int nFID = 16;
//终端编号
//sTName
//参数打包
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, sMID, ref oResp);
arrThreshold = (string[])oResp;
return res;
}
/*
*GetInfo
*
*2010-10-30
*string sTName ID, ref string sInfo
*bool true false
*IP线
*/
public bool GetInfo(string sTName, ref string sInfo)
{
bool res = false;
//类型编号
int nFID = 17;
//终端编号
//sTName
//参数打包
//struParam param = new struParam();
//param.sMID = sMID;
//param.lstParams = lstParams;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, null, ref oResp);
sInfo = (string)oResp;
return res;
}
/*
*SetElectricThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool SetElecPTCT(string sTName, string sMID, ref string[] arrParam)
{
bool res = false;
//类型编号
int nFID = 19;
//终端编号
//sTName
//参数打包
struParam param = new struParam();
param.sMID = sMID;
param.oParam = arrParam;
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, param, ref oResp);
//htRes = (Hashtable)oResp;
return res;
}
/*
*GetElectricThreshold
*
*2010-10-30
*string sTName ID, string sMID ID, ref string[] arrThreshold
*bool true false
*
*/
public bool GetElecPTCT(string sTName, string sMID, ref string[] arrParam)
{
bool res = false;
//类型编号
int nFID = 20;
//终端编号
//sTName
//参数打包
object oResp = null;
res = CommService.Common.platForm.tcpServer.HandleRemoteService(nFID, sTName, sMID, ref oResp);
arrParam = (string[])oResp;
return res;
}
}
}