You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.3 KiB
127 lines
4.3 KiB
5 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Text;
|
||
|
using System.Data;
|
||
|
using ICommLayer;
|
||
|
using DBFactory;
|
||
|
using CommonClassLib;
|
||
|
namespace SocketsTCPIP
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// ʹ��SocketsUDP�Ŀͻ��˽���ͨѶ
|
||
|
/// �����豸״̬
|
||
|
/// �����ߣ�Richard.Liu
|
||
|
/// </summary>
|
||
|
public class CGetDeviceState:IGetDeviceState
|
||
|
{
|
||
|
string _commLayerError;
|
||
|
|
||
|
public string CommLayerError
|
||
|
{
|
||
|
get { return _commLayerError; }
|
||
|
set { _commLayerError = value; }
|
||
|
}
|
||
|
|
||
|
DBOperator dbo =CClientTCPIP.dbo;
|
||
|
public CGetDeviceState()
|
||
|
{
|
||
|
dbo.Open();
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// [T]:��������:20000��29000
|
||
|
///[N]:�ڵ�����
|
||
|
///[N1]:ȡ����
|
||
|
///[N2]:����
|
||
|
/// [R]:��������:
|
||
|
///0: ȡ��
|
||
|
///1: ��
|
||
|
///[A]:LC�Ļظ�:
|
||
|
/// 0:ͬ��
|
||
|
/// 1:��ͬ��
|
||
|
///LC֪ͨMAN������ʼִ��63[T]
|
||
|
///LC֪ͨMANijAGV��λ64[T][N][R]
|
||
|
///LC֪ͨMAN���ؿ�ʼ65[T][N][R]
|
||
|
///LC֪ͨMAN���ؽ���66[T][N][R]
|
||
|
///LC֪ͨMAN������ͣ67[T][N][R]
|
||
|
///LC֪ͨMAN���ػָ�68[T][N][R]
|
||
|
///LC֪ͨMAN AGV����69[T][N][R]
|
||
|
///LC֪ͨMAN��������70[T]
|
||
|
///LC֪ͨMAN����ɾ��Ӧ��81[T][A]
|
||
|
/// </summary>
|
||
|
/// <param name="DeviceIndex"></param>
|
||
|
/// <param name="TaskIndex"></param>
|
||
|
/// <returns></returns>
|
||
|
public int[] GetDeviceState(int DeviceIndex, int TaskIndex)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
|
||
|
////����DeviceIndex,�õ�SocketsͨѶ�ij�ʼ����
|
||
|
//DataSet ds = dbo.ExceSQL("SELECT F_DeviceIndex,F_DeviceKindIndex, F_LocalIP, F_LocalPort, F_RemoteIP, F_RemotePort FROM T_Base_Device where F_DeviceIndex=" + DeviceIndex);
|
||
|
//DataView dv = ds.Tables[0].DefaultView;
|
||
|
//if (ds.Tables[0].DefaultView.Count == 0)
|
||
|
//{
|
||
|
// return null;
|
||
|
|
||
|
//}
|
||
|
|
||
|
//int[] _IntData = new int[14];
|
||
|
//byte[] _GetData = new byte[4];
|
||
|
//////////////////////////////////////////
|
||
|
|
||
|
//_GetData = CClientTCPIP.Receive(dv[0]["F_RemoteIP"].ToString(), (int)dv[0]["F_RemotePort"]);
|
||
|
|
||
|
//if (_GetData != null)
|
||
|
//{
|
||
|
// //////////////////////////////////////
|
||
|
// if ((_GetData[0] == 70) && (Convert.ToInt32(_GetData[3] * Math.Pow(2, 8) + _GetData[2]) == TaskIndex))
|
||
|
// {
|
||
|
// _IntData[1] = 1;//1-��������
|
||
|
// }
|
||
|
// else if ((_GetData[0] == 71))//������ʼ
|
||
|
// {
|
||
|
// _IntData[1] = 3;
|
||
|
// }
|
||
|
// else if ((_GetData[0] == 69))//AGV����
|
||
|
// {
|
||
|
// _IntData[1] = 69;
|
||
|
// }
|
||
|
// //82 �Ƿ�����������1�ܾ���0���ܣ�
|
||
|
// else if ((_GetData[2] ==0)&&(_GetData[0] == 82) && (Convert.ToInt32(_GetData[5] * Math.Pow(2, 8) + _GetData[4]) == TaskIndex))//AGV�Ƿ�����������0���ܣ�1�ܾ���
|
||
|
// {
|
||
|
// _IntData[0] = Convert.ToInt32(_GetData[3] * Math.Pow(2, 8) + _GetData[2]);
|
||
|
// _IntData[1] = 3;
|
||
|
// }
|
||
|
// else //64,65,66,67,68
|
||
|
// {
|
||
|
// _IntData[1] = 2;//2-��������
|
||
|
// _IntData[3] = Convert.ToInt32(_GetData[5] * Math.Pow(2, 8) + _GetData[4]);
|
||
|
// }
|
||
|
// //_IntData[0] = 0;//ʵ��ֵ
|
||
|
// _IntData[2] = TaskIndex;//������
|
||
|
// _IntData[4] = 0;
|
||
|
// _IntData[5] = DeviceIndex;// �豸��
|
||
|
// //cct.CloseSockets();
|
||
|
// return _IntData;
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// //cct.CloseSockets();
|
||
|
// _commLayerError = "CClientTCPIP" + ":GetDeviceState---" + CClientTCPIP.TcpError;
|
||
|
// return null;
|
||
|
//}
|
||
|
return null;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
public string GetStringData(int DeviceIndex, int TaskIndex)
|
||
|
{
|
||
|
return "";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|