终端一体化运控平台
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.
 
 
 

51 lines
1.4 KiB

  1. using System;
  2. using BPASmartClient.Peripheral;
  3. using BPASmartClient.SerialPort;
  4. using BPASmartClient.Model.µç¼Ðצ;
  5. using static BPASmartClient.EventBus.EventBus;
  6. using BPASmartClient.EventBus;
  7. namespace BPASmartClient.RobotGripper
  8. {
  9. public class RobotGripperMachine:BasePeripheral
  10. {
  11. RobotGripperHelper machineHelper = new RobotGripperHelper();
  12. public override void Init()
  13. {
  14. machineHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate);
  15. EventBus.EventBus.GetInstance().Subscribe<WriteGripper>(DeviceId,delegate(IEvent @event, EventCallBackHandle callBack)
  16. {
  17. if (@event == null) return;
  18. var par = @event as WriteGripper;
  19. switch (par?.TagName)
  20. {
  21. case "PWMControl":
  22. machineHelper.Write(Convert.ToByte(par?.CH_Number), Convert.ToString(par?.PWMOutput));
  23. break;
  24. default:
  25. break;
  26. }
  27. });
  28. }
  29. public override void Start()
  30. {
  31. }
  32. public override void Stop()
  33. {
  34. machineHelper.Stop(communicationPar.SerialPort);
  35. }
  36. public override void WriteData(string address, object value)
  37. {
  38. }
  39. protected override void InitStatus()
  40. {
  41. }
  42. }
  43. }