MQTTHelper.cs 979 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Globalization;
  5. namespace ToneTuneToolkit.MQTT
  6. {
  7. public class MQTTHelper : MonoBehaviour
  8. {
  9. public static MQTTHelper Instance;
  10. private string SolidMessage = "{\"data_type\":\"03\",\"data_content\":{\"msg_id\":\"3ab7d42c-e959-4855-a73e-0675b86f3297\",\"msg_level\":0,\"op_type\":\"02\",\"op_data\":\"\",\"op_target\":[\"E65E\"]},\"timestamp\":1535361775271}";
  11. // ==================================================
  12. private void Awake()
  13. {
  14. Instance = this;
  15. }
  16. // private void Update()
  17. // {
  18. // if (Input.GetKeyDown(KeyCode.Q))
  19. // {
  20. // SpeedSendMQTT();
  21. // }
  22. // }
  23. // ==================================================
  24. public void SpeedSendMQTT()
  25. {
  26. MQTTManager.Instance.SendMessageOut("PREFIX/uwb/message/send/engine_id", SolidMessage.ToString(CultureInfo.InvariantCulture));
  27. return;
  28. }
  29. }
  30. }