123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using Pms.Models;
- using ProjectManagementSystem.Common.Extenions;
- using ProjectManagementSystem.Common.WebApi;
- using ProjectManagementSystem.Device.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ProjectManagementSystem.Common.Core
- {
- public class CommunicationVcu : CommunicationBase, ICommunication
- {
- private static CommunicationVcu m_instance;
- private string addressName = "VCU";
- public static CommunicationVcu Instance
- {
- get
- {
- if (m_instance == null)
- {
- m_instance = new CommunicationVcu();
- }
- return m_instance;
- }
- }
- private CommunicationVcu()
- {
- }
-
- public void SendCommand(byte[] data, string address)
- {
- if (address == addressName)
- {
- int agvId = BitConverter.ToUInt16(data, 1);
- PmsApi.SendTransparentData(agvId, data);
- }
- }
- public void Received(byte[] data)
- {
- try
- {
- LogMsg($"{addressName}: Recv: {data.ToHexString()}");
- DataReceived?.Invoke(addressName, data);
- }
- catch (Exception ex)
- {
- LogMsg("接收VCU数据异常", ex);
- }
- }
- }
- }
|