| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Threading.Tasks;
- using TeamAAS_VP.Enums;
- using TeamAAS_VP.Models;
- using TeamAAS_VP.Models.Calibration;
- using TeamAAS_VP.Models.Feeder;
- using TeamAAS_VP.Models.Lights;
- using TeamAAS_VP.Models.PLC;
- using TeamAAS_VP.Models.ScrewDriver;
- using TeamAAS_VP.Models.Torque;
- namespace TeamAAS_VP.Interfaces
- {
- /// <summary>
- /// ���ù���������ϵͳ���á�����������ˡ�Feeder��PLC����̨ͨѶ�����õ���ɾ�IJ���־û���
- /// ʵ���ฺ�����ڴ���־û��洢�������ļ������ݿ⣩֮��ͬ�����ݣ����ṩͬ�����첽�ļ���/����ӿڡ�
- /// </summary>
- public interface IConfigService : IDisposable
- {
- // Load/Save
- /// <summary>
- /// ͬ�������������ã��ӳ־û��洢��ȡ�������ڴ��е����ã���
- /// </summary>
- /// <remarks>
- /// �÷���Ϊ�������ã�������Ӧ������ʱ����ȷ��Ҫͬ�����صij�����
- /// ʵ��Ӧ��֤�ڷ�������ʱ��¼��־���ڱ�Ҫʱ�׳��쳣��֪ͨ���÷���
- /// </remarks>
- void LoadAll();
- /// <summary>
- /// �첽�����������ã��ӳ־û��洢��ȡ�������ڴ��е����ã���
- /// </summary>
- /// <returns>һ����ʾ�첽���ز���������</returns>
- Task LoadAllAsync();
- /// <summary>
- /// ͬ���������е�ǰ�ڴ��е����õ��־û��洢��
- /// </summary>
- /// <remarks>
- /// �÷���Ϊ�������ã���������Ҫ������֤���ó־û��ij�����
- /// </remarks>
- void SaveAll();
- /// <summary>
- /// �첽�������е�ǰ�ڴ��е����õ��־û��洢��
- /// </summary>
- /// <returns>��ʾ���������ɵ�����</returns>
- Task SaveAllAsync();
- // Cameras
- /// <summary>
- /// ��ȡ������ע��������Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>�����Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<CameraInfo> GetAllCameras();
- /// <summary>
- /// ���ݱ�ʶ��ȡ���������Ϣ��
- /// </summary>
- /// <param name="id">�����Ψһ��ʶ����</param>
- /// <returns>��Ӧ�� <see cref="CameraInfo"/> ʵ������δ�ҵ��� null��</returns>
- CameraInfo GetCamera(Guid id);
- /// <summary>
- /// ���������ָ���������Ϣ��
- /// </summary>
- /// <param name="camera">Ҫ��������µ������Ϣ������Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="camera"/> Ϊ null ʱ�׳���</exception>
- CameraInfo AddOrUpdateCamera(CameraInfo camera);
- /// <summary>
- /// �Ƴ�ָ����ʶ�������Ϣ��
- /// </summary>
- /// <param name="id">Ҫ�Ƴ��������Ψһ��ʶ����</param>
- /// <returns>����ҵ����Ƴ��ɹ��� true������ false��</returns>
- bool RemoveCamera(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ��������á�
- /// </summary>
- /// <param name="id">���Ψһ��ʶ����</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsCamera(Guid id);
- // Robots
- /// <summary>
- /// ��ȡ������ע��Ļ�������Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>��������Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<RobotInfo> GetAllRobots();
- /// <summary>
- /// ���ݱ�ʶ��ȡ������������Ϣ��
- /// </summary>
- /// <param name="id">�����˵�Ψһ��ʶ����</param>
- /// <returns>��Ӧ�� <see cref="RobotInfo"/> ʵ������δ�ҵ��� null��</returns>
- RobotInfo GetRobot(Guid id);
- /// <summary>
- /// ���������ָ���Ļ�������Ϣ��
- /// </summary>
- /// <param name="robot">Ҫ��������µĻ�������Ϣ������Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="robot"/> Ϊ null ʱ�׳���</exception>
- RobotInfo AddOrUpdateRobot(RobotInfo robot);
- /// <summary>
- /// �Ƴ�ָ����ʶ�Ļ�������Ϣ��
- /// </summary>
- /// <param name="id">Ҫ�Ƴ��Ļ����˵�Ψһ��ʶ����</param>
- /// <returns>����ҵ����Ƴ��ɹ��� true������ false��</returns>
- bool RemoveRobot(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ�Ļ��������á�
- /// </summary>
- /// <param name="id">������Ψһ��ʶ����</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsRobot(Guid id);
- /// <summary>
- /// ��ָ��������id�IJ�������
- /// </summary>
- /// <param name="id">������Ψһ��ʶ����</param>
- /// <param name="stepDistance">��������</param>
- /// <returns></returns>
- bool UpdateRobotStepDistance(Guid id, double stepDistance);
- /// <summary>
- /// ��ȡָ��������Id�IJ�������
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- double GetRobotStepDistance(Guid id);
- // Feeders
- /// <summary>
- /// ��ȡ������ע��� Feeder ��Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>Feeder ��Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<FeederInfo> GetAllFeeders();
- /// <summary>
- /// ���ݱ�ʶ��ȡ���� Feeder ��Ϣ��
- /// </summary>
- /// <param name="id">Feeder ��Ψһ��ʶ����</param>
- /// <returns>��Ӧ�� <see cref="FeederInfo"/> ʵ������δ�ҵ��� null��</returns>
- FeederInfo GetFeeder(Guid id);
- /// <summary>
- /// ���������ָ���� Feeder ��Ϣ��
- /// </summary>
- /// <param name="feeder">Ҫ��������µ� Feeder ��Ϣ������Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="feeder"/> Ϊ null ʱ�׳���</exception>
- FeederInfo AddOrUpdateFeeder(FeederInfo feeder);
- /// <summary>
- /// �Ƴ�ָ����ʶ�� Feeder ��Ϣ��
- /// </summary>
- /// <param name="id">Ҫ�Ƴ��� Feeder ��Ψһ��ʶ����</param>
- /// <returns>����ҵ����Ƴ��ɹ��� true������ false��</returns>
- bool RemoveFeeder(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ�� Feeder ���á�
- /// </summary>
- /// <param name="id">Feeder Ψһ��ʶ����</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsFeeder(Guid id);
- // PLCs
- /// <summary>
- /// ��ȡ������ע��� PLC ��Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>PLC ��Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<PlcInfo> GetAllPlcs();
- /// <summary>
- /// ���ݱ�ʶ��ȡ���� PLC ��Ϣ��
- /// </summary>
- /// <param name="id">PLC ��Ψһ��ʶ����</param>
- /// <returns>��Ӧ�� <see cref="PlcInfo"/> ʵ������δ�ҵ��� null��</returns>
- PlcInfo GetPlc(Guid id);
- /// <summary>
- /// ���������ָ���� PLC ��Ϣ��
- /// </summary>
- /// <param name="plc">Ҫ��������µ� PLC ��Ϣ������Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="plc"/> Ϊ null ʱ�׳���</exception>
- PlcInfo AddOrUpdatePlc(PlcInfo plc);
- /// <summary>
- /// �Ƴ�ָ����ʶ�� PLC ��Ϣ��
- /// </summary>
- /// <param name="id">Ҫ�Ƴ��� PLC ��Ψһ��ʶ����</param>
- /// <returns>����ҵ����Ƴ��ɹ��� true������ false��</returns>
- bool RemovePlc(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ�� PLC ���á�
- /// </summary>
- /// <param name="id">PLC Ψһ��ʶ����</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsPlc(Guid id);
- // Plc Addresses
- /// <summary>
- /// Get all PlcAddress entries
- /// </summary>
- /// <returns></returns>
- PlcAddressConfig GetPlcAddresses();
-
- // Background TCP
- /// <summary>
- /// ��ȡ��̨ͨѶ��TCP/IP�����á�
- /// </summary>
- /// <returns>��ǰ��̨ TCP ���ÿ��ա�</returns>
- BgTcpIP GetBgTcp();
- /// <summary>
- /// ���ú�̨ͨѶ��TCP/IP�����ã��������ڴ棩��
- /// </summary>
- /// <param name="cfg">�µĺ�̨ TCP ���ã�����Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="cfg"/> Ϊ null ʱ�׳���</exception>
- void SetBgTcp(BgTcpIP cfg);
- /// <summary>
- /// ����ǰ�ڴ��еĺ�̨ TCP ���ñ��浽�־û��洢��
- /// </summary>
- void SaveBgTcp();
- // Background Modbus
- /// <summary>
- /// ��ȡ��̨ Modbus TCP ���á�
- /// </summary>
- /// <returns>��ǰ��̨ Modbus TCP ���ÿ��ա�</returns>
- BgModbusTcp GetBgModbusTcp();
- /// <summary>
- /// ���ú�̨ Modbus TCP ���ã��������ڴ棩��
- /// </summary>
- /// <param name="cfg">�µĺ�̨ Modbus TCP ���ã�����Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="cfg"/> Ϊ null ʱ�׳���</exception>
- void SetBgModbusTcp(BgModbusTcp cfg);
- /// <summary>
- /// ����ǰ�ڴ��еĺ�̨ Modbus TCP ���ñ��浽�־û��洢��
- /// </summary>
- void SaveBgModbusTcp();
- //ϵͳ����
- /// <summary>
- /// ��ȡϵͳ����
- /// </summary>
- /// <returns></returns>
- SystemConfiguration GetSystemConfiguration();
- /// <summary>
- /// ����ϵͳ����
- /// </summary>
- void SaveSystemConfiguration(SystemConfiguration systemConfiguration);
- /// <summary>
- /// ��ȡ��ǰ����
- /// </summary>
- /// <returns></returns>
- Language GetCurrentLanguage();
- /// <summary>
- /// ���õ�ǰ����
- /// </summary>
- /// <param name="language"></param>
- void SetCurrentLanguage(Language language);
- //��������
- /// <summary>
- /// ��ȡ������������
- /// </summary>
- /// <returns></returns>
- IReadOnlyCollection<FeederClearWork> GetAllClearanceTasks();
- /// <summary>
- /// �����������������
- /// </summary>
- /// <param name="task"></param>
- /// <returns></returns>
- FeederClearWork AddOrUpdateClearanceTask(FeederClearWork task);
- /// <summary>
- /// �Ƴ���������
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- bool RemoveClearanceTask(Guid id);
- /// <summary>
- /// ���������������
- /// </summary>
- void ClearAllClearanceTasks();
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ����������
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- bool ContainsClearanceTask(Guid id);
- /// <summary>
- /// ���ݱ�ʶ��ȡ��������������Ϣ
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- FeederClearWork GetClearanceTask(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ŵ���������
- /// </summary>
- /// <param name="taskNumber"></param>
- /// <returns></returns>
- bool ContainsClearanceTaskByNumber(int taskNumber);
- /// <summary>
- /// ���ݱ�Ż�ȡ��������������Ϣ
- /// </summary>
- /// <param name="taskNumber"></param>
- /// <returns></returns>
- FeederClearWork GetClearanceTaskByNumber(int taskNumber);
- // Light controllers and channels
- /// <summary>
- /// ��ȡ������ע��ĵƹ��������Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>�ƹ��������Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<LightControllerConfig> GetAllLightControllers();
- /// <summary>
- /// ���ݱ�ʶ��ȡ�����ƹ��������Ϣ��
- /// </summary>
- /// <param name="id">�ƹ��������Ψһ��ʶ����</param>
- /// <returns>��Ӧ�� <see cref="LightControllerConfig"/> ʵ������δ�ҵ��� null��</returns>
- LightControllerConfig GetLightController(int id);
- /// <summary>
- /// ���������ָ���ĵƹ��������Ϣ��
- /// </summary>
- /// <param name="controller">Ҫ��������µĵƹ��������Ϣ������Ϊ null��</param>
- /// <exception cref="ArgumentNullException">�� <paramref name="controller"/> Ϊ null ʱ�׳���</exception>
- LightControllerConfig AddOrUpdateLightController(LightControllerConfig controller);
- /// <summary>
- /// �Ƴ�ָ����ʶ�ĵƹ��������Ϣ��
- /// </summary>
- /// <param name="id">Ҫ�Ƴ��ĵƹ��������Ψһ��ʶ����</param>
- /// <returns>����ҵ����Ƴ��ɹ��� true������ false��</returns>
- bool RemoveLightController(int id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ�ĵƹ���������á�
- /// </summary>
- /// <param name="id">�ƹ������Ψһ��ʶ����</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsLightController(int id);
- /// <summary>
- /// ��ȡ������ע��ĵƹ�ͨ����Ϣ��ֻ�����ϡ�
- /// </summary>
- /// <returns>�ƹ�ͨ����Ϣ��ֻ�����Ͽ��ա�</returns>
- IReadOnlyCollection<ChannelConfig> GetAllLightChannels();
- /// <summary>
- /// ����ȫ��������ȡ�����ƹ�ͨ����Ϣ��
- /// </summary>
- /// <param name="globalIndex">�ƹ�ͨ����ȫ��������</param>
- /// <returns>��Ӧ�� <see cref="ChannelConfig"/> ʵ������δ�ҵ��� null��</returns>
- ChannelConfig GetLightChannelByGlobalIndex(int globalIndex);
- /// <summary>
- /// �ж��Ƿ����ָ��ȫ�������ĵƹ�ͨ�����á�
- /// </summary>
- /// <param name="globalIndex">�ƹ�ͨ����ȫ��������</param>
- /// <returns>������ true������ false��</returns>
- bool ContainsLightChannelByGlobalIndex(int globalIndex);
- /// <summary>
- /// ����ָ���ƹ�ͨ����Ĭ������ֵ�����浽�־û��洢��
- /// </summary>
- /// <param name="globalIndex">�ƹ�ͨ����ȫ��������</param>
- /// <param name="brightness">�µ�Ĭ������ֵ����ΧӦ�ں��ʵ������ڡ�</param>
- /// <returns>����ҵ������³ɹ��� true������ false��</returns>
- bool UpdateChannelDefaultBrightness(int globalIndex, int brightness);
- // Screw driver (single device) configuration accessors
- /// <summary>
- /// ��ȡ�������ã����豸����
- /// </summary>
- /// <returns>��ǰ�� <see cref="ScrewDriverConfig"/>����δ������ null��</returns>
- ScrewDriverConfig GetScrewDriverConfig();
- /// <summary>
- /// ���ò��־û��������ã����豸����
- /// </summary>
- /// <param name="cfg">�µ����ö�����Ϊ�ա�</param>
- void SetScrewDriverConfig(ScrewDriverConfig cfg);
- // Device info - 支持多设备
- /// <summary>
- /// 获取所有设备信息配置列表
- /// </summary>
- /// <returns>设备信息列表的只读集合</returns>
- IReadOnlyCollection<DeviceInfo> GetAllDeviceInfos();
- /// <summary>
- /// 根据设备编号获取设备信息(兼容旧API,返回第一个设备)
- /// </summary>
- DeviceInfo GetDeviceInfo();
- /// <summary>
- /// 根据设备编号获取设备信息
- /// </summary>
- /// <param name="deviceNo">设备编号</param>
- DeviceInfo GetDeviceInfo(int deviceNo);
- /// <summary>
- /// 保存设备信息配置(添加或更新)
- /// </summary>
- void SaveDeviceInfo(DeviceInfo deviceInfo);
- /// <summary>
- /// 保存所有设备信息列表
- /// </summary>
- /// <param name="deviceInfoList">设备信息列表</param>
- void SaveAllDeviceInfos(IEnumerable<DeviceInfo> deviceInfoList);
- /// <summary>
- /// 添加新设备
- /// </summary>
- /// <returns>新添加的设备</returns>
- DeviceInfo AddDeviceInfo();
- /// <summary>
- /// 删除设备
- /// </summary>
- /// <param name="deviceNo">设备编号</param>
- /// <returns>是否删除成功</returns>
- bool RemoveDeviceInfo(int deviceNo);
- /// <summary>
- /// ������ǰ�ڴ��еĵ������ñ��浽�ļ���
- /// </summary>
- void SaveScrewDriverConfig();
- // Screw feeder (material) management
- /// <summary>
- /// ��ȡ������ע�����˿��������Ϣ��ֻ�����ϡ�
- /// </summary>
- IReadOnlyCollection<ScrewFeederInfo> GetAllScrewFeeders();
- /// <summary>
- /// ���ݱ�ʶ��ȡ������˿��������Ϣ��
- /// </summary>
- ScrewFeederInfo GetScrewFeeder(Guid id);
- /// <summary>
- /// ���������ָ������˿��������Ϣ��
- /// </summary>
- ScrewFeederInfo AddOrUpdateScrewFeeder(ScrewFeederInfo feeder);
- /// <summary>
- /// �Ƴ�ָ����ʶ����˿��������Ϣ��
- /// </summary>
- bool RemoveScrewFeeder(Guid id);
- /// <summary>
- /// �ж��Ƿ����ָ����ʶ����˿���������á�
- /// </summary>
- bool ContainsScrewFeeder(Guid id);
- /// <summary>
- /// Ϊָ����������ŵݼ�ָ��������ͨ��Ϊ 1�������������㷵�� false
- /// </summary>
- int DecrementScrewCountByFeederNumber(int feederNumber, int decrement = 1);
- /// <summary>
- /// ���ָ����������ŵ���˿��Ϣ�����κ���ʣ�������ÿ�/��0��
- /// </summary>
- void ClearScrewFeederByNumber(int feederNumber);
- /// <summary>
- /// Ϊָ�����������������˿���κţ�����ԭ��ʣ������������һ����������PackSize��
- /// </summary>
- void SetBatchForFeederNumber(int feederNumber, string batchNumber);
- /// <summary>
- /// ��ȡָ����������ŵ�ʣ����˿�������Ҳ������� -1��
- /// </summary>
- int GetRemainingCountByFeederNumber(int feederNumber);
- /// <summary>
- /// ��ȡָ����������ŵĵ�������״̬���Ҳ������� false��
- /// </summary>
- bool GetLowLevelAlarmStatusByFeederNumber(int feederNumber);
- /// <summary>
- /// ��ij����˿������������������ʱ�ᴥ�����¼��������߿������ϱ��� UI ��ʾ��
- /// </summary>
- event Action<ScrewFeederInfo> ScrewFeederLowLevelAlarmTriggered;
- /// <summary>
- /// ���ʣ����˿�Ƿ�
- /// </summary>
- bool CheckAlarm(int feederNumber);
- //ˢ����¼
- /// <summary>
- /// ��ȡˢ��������
- /// </summary>
- /// <returns></returns>
- SerialPortConfig GetCardReaderConfig();
- /// <summary>
- /// ����ˢ��������
- /// </summary>
- /// <param name="config"></param>
- void SaveCardReaderConfig(SerialPortConfig config);
- void SaveTorqueReaderConfig(TorqueSerialPortConfig config);
- TorqueSerialPortConfig GetTorqueReaderConfig();
- CTQ_Data GetCTQDataInfo();
- void SaveCTQDataInfo(CTQ_Data cd);
- }
- }
|