123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- @*@page
- @model Applications.UniversalApi_WebConsole_App.Views.TankDetails.TestModel
- @{
- }*@
- @{
- // Layout = null;
- }
- <script src="~/js/mqtt.min.js"></script>
- <script src="~/js/Chart.bundle.js"></script>
- <script src="~/js/jquery-3.4.1.min.js"></script>
- <body style="width:1250px;height:780px;background-color:aqua">
- <div id="test_div" style=""> </div>
- </body>
- <script>
-
- var hostname = 'localhost',
- port = 8384,
- clientId = 'mqttjs_' + (Math.random() * 1000000).toString(),
- timeout = 5000,
- keepAlive = 100,
- cleanSession = false,
- mqttVersion = 3,
- ssl = false;
- var options = {
-
- clientId: 'mqttjs_' + (Math.random() * 1000000).toString(),
- timeout: timeout,
- useSSL: false
- }
-
-
- var client = mqtt.connect("ws://localhost:8384/mqtt", options);
-
- client.on('connect',
- function () {
- var a = document.getElementById("testmqqt");
- if (a != null) a.innerHTML = "connected";
-
- client.subscribe('/sys/VeederRoot_ATG_Console_Tcp/VeederRoot_ATG_Console.Handler/thing/service/GetTankInventoryAsync_reply',
- function (err) {
- if (!err) {
- console.log("Subscribe TankReadig success");
-
- } else {
-
- if (a != null) a.innerHTML = err;
- }
- });
- client.subscribe('/sys/VeederRoot_ATG_Console_Tcp/VeederRoot_ATG_Console.Handler/thing/service/GetTanksAsync_reply',
- function (err) {
- if (!err) {
- console.log("Subscribe getTAnk success");
- client.publish('/sys/VeederRoot_ATG_Console_Tcp/VeederRoot_ATG_Console.Handler/thing/service/GetTanksAsync',"[]");
-
- } else {
-
- if (a != null) a.innerHTML = err;
- }
- });
- });
-
-
-
- client.on('error',
- function (err) {
- var a = document.getElementById("test_div");
- if (a != null) a.innerHTML = err;
- client.end();
- });
-
- client.on('message',
- function (topic, message) {
- var a = document.getElementById("testmqqt");
-
- if (topic == "/sys/VeederRoot_ATG_Console_Tcp/VeederRoot_ATG_Console.Handler/thing/service/GetTankInventoryAsync_reply") {
-
-
-
-
-
- }
- if (topic == "/sys/VeederRoot_ATG_Console_Tcp/VeederRoot_ATG_Console.Handler/thing/service/GetTanksAsync_reply") {
-
-
-
-
- }
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- </script>
|