Skip to content

Commit

Permalink
broker setting can now be IP address or hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
fasteddy516 committed Feb 27, 2021
1 parent eded8b8 commit d8ea114
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions SimplMQTT/MqttClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ushort bufferSize
MqttSettings.Instance.Password = password;
MqttSettings.Instance.BufferSize = Convert.ToInt32(bufferSize);
MqttSettings.Instance.Port = Convert.ToInt32(brokerPort);
MqttSettings.Instance.IPAddressOfTheServer = IPAddress.Parse(brokerAddress);
MqttSettings.Instance.Broker = brokerAddress;
EnableSSL = (enableSSL > 0);
#if USE_LOGGER
CrestronLogger.WriteToLog("Instance Settings initialized", 1);
Expand Down Expand Up @@ -290,7 +290,7 @@ public void Publish(string topic, string value, uint retain)
public void Connect()
{
#if USE_LOGGER
CrestronLogger.WriteToLog("MQTTCLIENT - Connect , attempting connection to " + MqttSettings.Instance.IPAddressOfTheServer.ToString(), 1);
CrestronLogger.WriteToLog("MQTTCLIENT - Connect , attempting connection to " + MqttSettings.Instance.Broker.ToString(), 1);
#endif
ClientConnectToServerAsync();
}
Expand Down
2 changes: 1 addition & 1 deletion SimplMQTT/MqttSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class MqttSettings
/// </summary>
public string Password { get; internal set; }

public IPAddress IPAddressOfTheServer { get; internal set; }
public string Broker { get; internal set; }

public int BufferSize { get; internal set; }
/// <summary>
Expand Down
6 changes: 1 addition & 5 deletions SimplWindows/SimplMQTT Client.ush
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
ParamCue1=[Reference Name]
ParamCue2=ClientID
ParamSigType2=String
ParamCue3=BrokerAddress
ParamCue3=Broker
ParamSigType3=String
ParamCue4=BrokerPort
ParamSigType4=Constant
Expand Down Expand Up @@ -801,7 +801,3 @@
NoS=False
VVS=0
[END]
[BEGIN]
ObjTp=Status
HeaderCompatible=False
[END]
6 changes: 3 additions & 3 deletions SimplWindows/SimplMQTT Client.usp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ string_parameter ClientID[20];
propShortDescription = "String used to identify the client to the broker - must be unique for each client.";
#end_parameter_properties

string_parameter BrokerAddress[14];
#begin_parameter_properties BrokerAddress
string_parameter Broker[14];
#begin_parameter_properties Broker
propDefaultUnit = unitString;
propValidUnits = unitString;
propShortDescription = "IP address of the MQTT broker.";
Expand Down Expand Up @@ -436,7 +436,7 @@ function main()

client.Initialize(
ClientID,
BrokerAddress,
Broker,
BrokerPort,
UseSSL,
Username,
Expand Down
12 changes: 6 additions & 6 deletions SimplWindows/SimplMQTT Demo.smw
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ Ym=-1
SH=20
Z=100
Ht=3
Hi=5
Hi=7
]
[
ObjTp=Sm
Expand Down Expand Up @@ -1255,7 +1255,7 @@ SmC=156
Nm=Logic
ObjVer=1
SmVr=1133
CF=1
CF=2
mC=5
C1=25
C2=23
Expand Down Expand Up @@ -1513,7 +1513,7 @@ SmC=103
Nm=SimplMQTT Client.usp
ObjVer=1
PrH=4
CF=1
CF=2
n1I=26
n2I=20
n1O=26
Expand Down Expand Up @@ -1585,10 +1585,10 @@ O46=4
mP=47
P1=
P2=crestron_rmc3
P3=
P3=mqttbroker
P4=1883d
P5=
P6=
P5=mqttuser
P6=mqttpass
P7=0d
P8=x
P9=x
Expand Down
Binary file modified SimplWindows/SimplMQTT.Client.clz
Binary file not shown.

0 comments on commit d8ea114

Please sign in to comment.