using System; using BPASmartClient.Peripheral; using BPASmartClient.SerialPort; using BPASmartClient.Model.µç¼Ðצ; using static BPASmartClient.EventBus.EventBus; using BPASmartClient.EventBus; namespace BPASmartClient.RobotGripper { public class RobotGripperMachine:BasePeripheral { RobotGripperHelper machineHelper = new RobotGripperHelper(); public override void Init() { machineHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); EventBus.EventBus.GetInstance().Subscribe(DeviceId,delegate(IEvent @event, EventCallBackHandle callBack) { if (@event == null) return; var par = @event as WriteGripper; switch (par?.TagName) { case "PWMControl": machineHelper.Write(Convert.ToByte(par?.CH_Number), Convert.ToString(par?.PWMOutput)); break; default: break; } }); } public override void Start() { } public override void Stop() { machineHelper.Stop(communicationPar.SerialPort); } public override void WriteData(string address, object value) { } protected override void InitStatus() { } } }