Skip to content

Commit

Permalink
Updated Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Nov 29, 2023
1 parent 2011c8d commit 215e8e8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 40 deletions.
64 changes: 32 additions & 32 deletions agent/MTConnect.NET-Agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,15 @@ More information about [Configurations](https://github.com/TrakHound/MTConnect.N
# - Device Configuration -
devices: devices

# - Processors -
processors:
- python: # - Add Python Processor
directory: processors

# - Modules -
- modules:
modules:

# - Add HTTP Server module
- http-server:
- http-server: # - Add HTTP Server module
hostname: localhost
port: 7878
allowPut: true
Expand All @@ -145,37 +149,33 @@ devices: devices
- br
files:
- path: schemas
location: schemas
location: schemas
- path: styles
location: styles
location: styles
- path: styles/favicon.ico
location: favicon.ico

# - Add MQTT Relay module
- mqtt2-relay:
server: localhost
port: 1883
currentInterval: 5000
sampleInterval: 500

# - Add SHDR Adapter module for Device = M12346 and Port = 7878
- shdr-adapter:
deviceKey: M12346
hostname: localhost
port: 7878

# - Add SHDR Adapter module for Device = OKUMA-Lathe and Port = 7879
- shdr-adapter:
deviceKey: OKUMA-Lathe
hostname: localhost
port: 7879

# - Add MQTT Adapter module for Device = M12346 and Topic = cnc-01
- mqtt-adapter:
deviceKey: M12346
server: localhost
port: 1883
topic: cnc-01
location: favicon.ico

- mqtt2-relay: # - Add MQTT Relay module
server: localhost
port: 1883
currentInterval: 5000
sampleInterval: 500

- shdr-adapter: # - Add SHDR Adapter module for Device = M12346 and Port = 7878
deviceKey: M12346
hostname: localhost
port: 7878

- shdr-adapter: # - Add SHDR Adapter module for Device = OKUMA-Lathe and Port = 7879
deviceKey: OKUMA-Lathe
hostname: localhost
port: 7879

- mqtt-adapter: # - Add MQTT Adapter module for Device = M12346 and Topic = cnc-01
deviceKey: M12346
server: localhost
port: 1883
topic: cnc-01


# The maximum number of Observations the agent can hold in its buffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This Agent Module implements an adapter to read from other MTConnect Agents usin
```yaml
- http-adapter:
address: localhost
port: 5001
port: 5000
deviceKey: M12346
interval: 100
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This Agent Module implements the MTConnect REST Protocol
```yaml
- http-server:
hostname: localhost
port: 7878
port: 5000
allowPut: true
indentOutput: true
documentFormat: xml
Expand Down
6 changes: 1 addition & 5 deletions agent/Modules/MTConnect.NET-AgentModule-MqttRelay/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ private async Task Worker()

Log(Logging.MTConnectLogLevel.Information, $"MQTT Relay Connected to External Broker ({_configuration.Server}:{_configuration.Port})");

//if (Connected != null) Connected.Invoke(this, new EventArgs());

_server.Start();

while (!_stop.Token.IsCancellationRequested && _mqttClient.IsConnected)
Expand All @@ -146,11 +144,9 @@ private async Task Worker()
catch (Exception ex)
{
Log(Logging.MTConnectLogLevel.Warning, $"MQTT Relay Connection Error : {ex.Message}");
//if (ConnectionError != null) ConnectionError.Invoke(this, ex);
}

Log(Logging.MTConnectLogLevel.Information, $"MQTT Relay Disconnected from External Broker ({_configuration.Server}:{_configuration.Port})");
//if (Disconnected != null) Disconnected.Invoke(this, new EventArgs());

await Task.Delay(_configuration.ReconnectInterval, _stop.Token);
}
Expand Down Expand Up @@ -220,7 +216,7 @@ private async void SampleReceived(IDevice device, IStreamsResponseOutputDocument
var topic = $"{_configuration.TopicPrefix}/{device.Uuid}/{_configuration.SampleTopic}";

var message = new MqttApplicationMessage();
message.Retain = true;
//message.Retain = true;
message.Topic = topic;
message.QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtLeastOnce;
message.Payload = formatResult.Content;
Expand Down
2 changes: 1 addition & 1 deletion libraries/MTConnect.NET-SHDR/Shdr/ShdrClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ private static string GetDataItemKey(string line)
var x = ShdrLine.GetNextSegment(line);
var y = ShdrLine.GetNextValue(x);

if (y.Contains(":"))
if (y != null && y.Contains(":"))
{
var i = y.IndexOf(':');
y = y.Substring(i + 1);
Expand Down

0 comments on commit 215e8e8

Please sign in to comment.