sps_mqtt_bridge 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sps_mqtt_bridge.rb +9 -7
- metadata +26 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a5e033bc6dc64b982da206085d84ddfbf3f53fc
|
4
|
+
data.tar.gz: 319be0bb9b097e53a5a166a9cdaf85007e58f40b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acaae8c1ee4a4d535ae293e0d2ee5388a36d9e68c5e9d3e1d17c066116ff692c4be528cb86ea89fd8e85425a30a7c51bcdf10b733218805f8330696b475ee73e
|
7
|
+
data.tar.gz: 36c6414576c4f35f2b63d8b8c47211c5d7d9396704762a8afcc44f228b1fa6b13d8825d4eb39e4236271e31959cda7792ce00c882d79fe8b57e5ddce7382b9af
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sps_mqtt_bridge.rb
CHANGED
@@ -13,7 +13,8 @@ require 'timeout' # used sps_to_http
|
|
13
13
|
class SpsMqttBridge
|
14
14
|
|
15
15
|
def initialize(mqtt: {address: 'mqtt', port: '1883'},
|
16
|
-
sps:{
|
16
|
+
sps:{host: 'sps', address: host, port: '59000'},
|
17
|
+
sps2:{address: 'sps', port: '59000'})
|
17
18
|
@mqtt, @sps, @sps2 = mqtt, sps, sps2
|
18
19
|
end
|
19
20
|
|
@@ -53,9 +54,10 @@ class SpsMqttBridge
|
|
53
54
|
def sps_to_http(topic: '#', url: '', timeout: 5, \
|
54
55
|
http_auth: ["user", "password"])
|
55
56
|
|
56
|
-
SPSSub.new(host: @sps[:address], port: @sps[:port])
|
57
|
-
|
58
|
-
|
57
|
+
sps = SPSSub.new(host: @sps[:address], port: @sps[:port])
|
58
|
+
|
59
|
+
sps.subscribe(topic: topic) do |message,t|
|
60
|
+
|
59
61
|
begin
|
60
62
|
|
61
63
|
Timeout::timeout(timeout){
|
@@ -63,8 +65,8 @@ class SpsMqttBridge
|
|
63
65
|
ipaddr = url[/https?:\/\/([^\/]+)/,1]
|
64
66
|
ip_address = block_given? ? yield(ipaddr) || ipaddr : ipaddr
|
65
67
|
full_url = url.sub(/(https?:\/\/)([^\/]+)/,'\1' + ip_address).\
|
66
|
-
sub('$topic',
|
67
|
-
|
68
|
+
sub('$topic', t).sub('$msg', message)
|
69
|
+
|
68
70
|
buffer = open(full_url, read_timeout: timeout,\
|
69
71
|
http_basic_authentication: http_auth).read
|
70
72
|
|
@@ -87,4 +89,4 @@ if __FILE__ == $0 then
|
|
87
89
|
|
88
90
|
bridge = SpsMqttBridge.new
|
89
91
|
bridge.mqtt_to_sps
|
90
|
-
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sps_mqtt_bridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE2MTEyMjIxNDUzOFoXDTE3MTEyMjIxNDUzOFowSDESMBAG
|
16
16
|
A1UEAw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
29
|
+
hPXKjZGScFS0MJsl1Y79eiqtJRON6mdBAs6Pi+Ch3e4gvAVO69oyBPZK3R0RvsA4
|
30
|
+
Np1AbLkw2Kn4lQKDLEuhrMhZXZ53dwjsOmx9EoeG9US+CMyS44psTU1z3OmXb1MV
|
31
|
+
trTSr27oqU1llXUyTNR5FS7j2l5LiPV2bOPgDjJ0c33BHPqp1UEUE9S0vrDAtcMJ
|
32
|
+
SHx7HKijT7Yt5A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sps-pub
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: '0.4'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.4.
|
45
|
+
version: 0.4.3
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: '0.4'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.4.
|
55
|
+
version: 0.4.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: sps-sub
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: '0.3'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.3.
|
65
|
+
version: 0.3.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,27 +72,27 @@ dependencies:
|
|
72
72
|
version: '0.3'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.
|
75
|
+
version: 0.3.2
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: mqtt
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.4'
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
85
|
+
version: 0.4.0
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '0.
|
92
|
+
version: '0.4'
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
95
|
+
version: 0.4.0
|
96
96
|
description:
|
97
97
|
email: james@r0bertson.co.uk
|
98
98
|
executables: []
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.5.1
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Subscribes and re-publishes messages automatically from MQTT to SPS or to
|
metadata.gz.sig
CHANGED
Binary file
|