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.
113 lines
3.3 KiB
113 lines
3.3 KiB
3 months ago
|
using System;
|
||
|
using System.Reflection;
|
||
|
using System.Collections;
|
||
|
using System.Configuration;
|
||
|
using ICommLayer;
|
||
|
using System.Data;
|
||
|
using DBFactory;
|
||
|
namespace CommLayerFactory
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// ͨѶ��ʽ�����
|
||
|
/// Creator:Richard.liu
|
||
|
/// </summary>
|
||
|
public sealed class CommModeCreate
|
||
|
{
|
||
|
private static string path = "";
|
||
|
private static Model.MDevice devinfo;//20100127
|
||
|
CommModeCreate()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
//Assembly.Load (AssemblyName) �ڸ������� AssemblyName �������£����س�����,return Assembly
|
||
|
// Assembly.CreateInstance(className)
|
||
|
// �Ӵ˳������в���IStack���ͣ�Ȼ��ʹ��ϵͳ��������������ʵ����
|
||
|
/// <summary>
|
||
|
/// �����豸����������ȡ�豸״̬��������
|
||
|
/// </summary>
|
||
|
/// <param name="Devices"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IGetDeviceState CreateGetDeviceState(int Devices)
|
||
|
{
|
||
|
|
||
|
try
|
||
|
{
|
||
|
path = GetPath(Devices);
|
||
|
string classname = path + ".CGetDeviceState";
|
||
|
return (IGetDeviceState)Assembly.Load(path).CreateInstance(classname);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw (ex);
|
||
|
}
|
||
|
}
|
||
|
///// <summary>
|
||
|
///// �ڴ��ڶ�ȡ����
|
||
|
///// </summary>
|
||
|
///// <param name="Devices"></param>
|
||
|
///// <returns></returns>
|
||
|
//public static IGetSerialData CreateGetSerialData(int Devices)
|
||
|
//{
|
||
|
|
||
|
// try
|
||
|
// {
|
||
|
// path = GetPath(Devices);
|
||
|
// string classname = path + ".CGetSerialData";
|
||
|
// return (IGetSerialData)Assembly.Load(path).CreateInstance(classname);
|
||
|
// }
|
||
|
// catch (Exception ex)
|
||
|
// {
|
||
|
// throw (ex);
|
||
|
// }
|
||
|
//}
|
||
|
/// <summary>
|
||
|
/// �����豸������������������������
|
||
|
/// </summary>
|
||
|
/// <param name="Devices"></param>
|
||
|
/// <returns></returns>
|
||
|
public static ISendDeviceOrder CreateSendDeviceOrder(int Devices)
|
||
|
{
|
||
|
|
||
|
try
|
||
|
{
|
||
|
path = GetPath(Devices);
|
||
|
string classname = path + ".CSendDeviceOrder";
|
||
|
return (ISendDeviceOrder)Assembly.Load(path).CreateInstance(classname);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw (ex);
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// �����豸��������ͨѶ�ӿڵ�������
|
||
|
/// </summary>
|
||
|
/// <param name="Devices"></param>
|
||
|
/// <returns></returns>
|
||
|
static string GetPath(int Devices)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
//20100127
|
||
|
devinfo = Model.CGetInfo.GetDeviceInfo(Devices);
|
||
|
//DataSet ds = dbo.ExceSQL("select F_CommType from T_Base_Device where (F_CommType IS NOT NULL) AND F_DeviceIndex=" + Devices);
|
||
|
if (devinfo.CommType!=null)
|
||
|
{
|
||
|
//dbo.Close();
|
||
|
return devinfo.CommType;//ds.Tables[0].DefaultView[0]["F_CommType"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//dbo.Close();
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
catch(Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|