Skip to content

Commit

Permalink
fix: fixes outlet name parsing to remove curly braces in WattboxSocke…
Browse files Browse the repository at this point in the history
…t.cs
  • Loading branch information
aknous committed Jun 16, 2023
1 parent 1f85645 commit d461efb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Pdu-Wattbox-Lib/WattboxSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ public void Connect()
public void GetStatus()
{
SendLine("?OutletStatus");
}

public void GetNames()
{
SendLine("?OutletName");
}


#endregion

private void PortGather_LineReceived(object sender, GenericCommMethodReceiveTextArgs args)
Expand All @@ -125,6 +122,7 @@ private void socket_ConnectionChange(object sender, GenericSocketStatusChageEven
if (args.Client.IsConnected)
{
SendLine("?Hostname");
SendLine("?OutletName");
}
}

Expand Down Expand Up @@ -156,6 +154,12 @@ public void ParseResponse(string data)
Debug.Console(2, this, "name substring: {0}", outletNameString);
var outletNameList = outletNameString.Split(',').ToList();

for (int i = 0; i < outletNameList.Count; i++)
{
var tempName = outletNameList[i];
outletNameList[i] = tempName.Substring(1, tempName.Length - 2);
}

var handler = UpdateOutletName;
if (handler != null) handler(outletNameList);

Expand Down Expand Up @@ -245,7 +249,6 @@ public void SendLine(string data)
if (data.Contains("!OutletSet"))
{
GetStatus();
GetNames();
}
}

Expand All @@ -259,7 +262,6 @@ public void SendLine(object data)
if (cmd.Contains("!OutletSet"))
{
GetStatus();
GetNames();
}

}
Expand Down

0 comments on commit d461efb

Please sign in to comment.