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#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
}
}
}