stinger-ipc 0.0.8__py3-none-any.whl → 0.0.10__py3-none-any.whl
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.
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/METADATA +1 -1
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/RECORD +11 -11
- stingeripc/templates/python/connection.py.jinja2 +2 -1
- stingeripc/templates/rust/client/Cargo.toml.jinja2 +3 -1
- stingeripc/templates/rust/server/Cargo.toml.jinja2 +2 -0
- stingeripc/templates/rust/server/examples/server.rs.jinja2 +4 -0
- stingeripc/templates/rust/server/src/lib.rs.jinja2 +8 -5
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/WHEEL +0 -0
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/entry_points.txt +0 -0
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/licenses/LICENSE +0 -0
- {stinger_ipc-0.0.8.dist-info → stinger_ipc-0.0.10.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
stinger_ipc-0.0.
|
1
|
+
stinger_ipc-0.0.10.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
2
2
|
stingeripc/__init__.py,sha256=PTr5WfMfB-GL4vp3-XMU8IwGv3Q5RXQ24H7JuEo3hdk,133
|
3
3
|
stingeripc/args.py,sha256=x3P8GRu9-jyiMl62t0FPqbWY18FbhMVN4eSa2UzUv6c,3960
|
4
4
|
stingeripc/asyncapi.py,sha256=DJZuz_LiQEJjQGlnfRtgOToWVD55uLw5ZoiZ95-bxZc,23291
|
@@ -28,13 +28,13 @@ stingeripc/templates/html/styles.css.jinja2,sha256=C0-ZZk4SIzG9dv9x9MrfhHrtkHBj7
|
|
28
28
|
stingeripc/templates/markdown/index.md.jinja2,sha256=yB1Jpawc1VdBAzmnCI0ikdvVlcjZXf-2xRs159XSnHg,6432
|
29
29
|
stingeripc/templates/python/__init__.py.jinja2,sha256=jdZ07ogzJLOgzqqkHjj2_8hld9uBDnvB1DXPXnWkt98,22
|
30
30
|
stingeripc/templates/python/client.py.jinja2,sha256=lUlnh-Z2ulDaomx-bR7RAgovmZ4QYLjck0c_885x8DY,16461
|
31
|
-
stingeripc/templates/python/connection.py.jinja2,sha256
|
31
|
+
stingeripc/templates/python/connection.py.jinja2,sha256=mTiiC_p4AEwIGH9mvyzYDdu_AKxpI_548LpapL5CM-4,7238
|
32
32
|
stingeripc/templates/python/interface_types.py.jinja2,sha256=BcCD0uCzDn1TAn1IvWhHiOsai6MczIBu12Xg0snTHk8,1711
|
33
33
|
stingeripc/templates/python/method_codes.py.jinja2,sha256=74i8iKk4Fu9_nE2SYTRrRK2G4mogfJx88ihbmjyfYVQ,1089
|
34
34
|
stingeripc/templates/python/pyproject.toml.jinja2,sha256=R-rgSv6RTdgPINvhCwJ180Vzjy9-WkqtLbLgnCov3CI,195
|
35
35
|
stingeripc/templates/python/server.py.jinja2,sha256=pxjzLPE7k3DG6zE-zXyK_I16ZF8k-xgbdh_182Fx_E8,11217
|
36
36
|
stingeripc/templates/rust/Cargo.toml.jinja2,sha256=teIu5y2AeqSkk0eUPT8CemvzmhRoblCUP5jdmonLfY4,70
|
37
|
-
stingeripc/templates/rust/client/Cargo.toml.jinja2,sha256=
|
37
|
+
stingeripc/templates/rust/client/Cargo.toml.jinja2,sha256=oymbdtF3apgD4nVxt-fa9__hSZaUFsvjA0AxJarPMGw,858
|
38
38
|
stingeripc/templates/rust/client/examples/client.rs.jinja2,sha256=pMLR-xyEJrK4289XUbFEB18HKe3kaRJDoeFBQ89SLU4,2075
|
39
39
|
stingeripc/templates/rust/client/src/lib.rs.jinja2,sha256=7GGy_IBH-DBHIZUCvvBq1xbTTVVMczvx5W-i0qO_fvw,15451
|
40
40
|
stingeripc/templates/rust/payloads/Cargo.toml.jinja2,sha256=t6WQ5BCBvjagCW8AgK4VYSNjW2OZCX30KQTXk27SGwI,739
|
@@ -42,16 +42,16 @@ stingeripc/templates/rust/payloads/examples/pub_and_recv.rs.jinja2,sha256=cIbunw
|
|
42
42
|
stingeripc/templates/rust/payloads/src/handler.rs.jinja2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
43
|
stingeripc/templates/rust/payloads/src/lib.rs.jinja2,sha256=3vBn2OGm_j7BoyHRHLcH1e0hKRBiqtbgHsz04rTaVMM,86
|
44
44
|
stingeripc/templates/rust/payloads/src/payloads.rs.jinja2,sha256=1PUSzmHLMBYsVaCR8gOMdHWK8dmODmLM3WSu9iysN-c,4380
|
45
|
-
stingeripc/templates/rust/server/Cargo.toml.jinja2,sha256=
|
46
|
-
stingeripc/templates/rust/server/examples/server.rs.jinja2,sha256=
|
47
|
-
stingeripc/templates/rust/server/src/lib.rs.jinja2,sha256=
|
45
|
+
stingeripc/templates/rust/server/Cargo.toml.jinja2,sha256=t2MIpoe34RYOtxvpS6ma7W0A9sLlMQBYblpALU805TQ,573
|
46
|
+
stingeripc/templates/rust/server/examples/server.rs.jinja2,sha256=NVNR_kamR3t4FSpfYGfao0S9DpK1zXTQcOZR1WDPAaI,3624
|
47
|
+
stingeripc/templates/rust/server/src/lib.rs.jinja2,sha256=OE9WxOUmKLc1iii8iXKn5BAwMpP9HXrIYcGdmZnQG7U,14973
|
48
48
|
stingeripc/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
stingeripc/tools/cli.py,sha256=oLfVQx4EqRgZ2AH9Xl7X6neXle-aJE55bSXTEvH7RDE,2303
|
50
50
|
stingeripc/tools/markdown_generator.py,sha256=HVEWcMjAfVnuWY29kxfAW1mvSxQSF-rdYFA2kWdLOn0,1174
|
51
51
|
stingeripc/tools/python_generator.py,sha256=GJwGI6DntkJPJjHN4xSeTD60KgY32gI43IvIByxWSsw,1845
|
52
52
|
stingeripc/tools/rust_generator.py,sha256=9E7SMDM-iHE3O26QI3ieAHIInlrLepWMAFRnflKk3KI,2235
|
53
|
-
stinger_ipc-0.0.
|
54
|
-
stinger_ipc-0.0.
|
55
|
-
stinger_ipc-0.0.
|
56
|
-
stinger_ipc-0.0.
|
57
|
-
stinger_ipc-0.0.
|
53
|
+
stinger_ipc-0.0.10.dist-info/METADATA,sha256=IWuujmhLBXd10UkK5gE5TMYfPHdPY1JTzev_X75npgs,6038
|
54
|
+
stinger_ipc-0.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
55
|
+
stinger_ipc-0.0.10.dist-info/entry_points.txt,sha256=bh8k8mvtAog4MKTd82ALSHqQkuD069VrZ-vNlde6XjE,204
|
56
|
+
stinger_ipc-0.0.10.dist-info/top_level.txt,sha256=mSNwAf83_1qiTP_vu7XEPBrZu-fDusT1FFyQZzCrRcU,11
|
57
|
+
stinger_ipc-0.0.10.dist-info/RECORD,,
|
@@ -45,7 +45,7 @@ class {{broker.class_name}}(BrokerConnection):
|
|
45
45
|
class PendingSubscription:
|
46
46
|
def __init__(self, topic: str, subscription_id: int):
|
47
47
|
self.topic = topic
|
48
|
-
self.subscription_id
|
48
|
+
self.subscription_id = subscription_id
|
49
49
|
|
50
50
|
def __init__(self{%if broker.hostname is none%}, host: str, port: int{%endif%}):
|
51
51
|
self._logger = logging.getLogger('Connection')
|
@@ -83,6 +83,7 @@ class {{broker.class_name}}(BrokerConnection):
|
|
83
83
|
self._message_callback = callback
|
84
84
|
|
85
85
|
def _on_message(self, client, userdata, msg):
|
86
|
+
self._logger.debug("Got a message to %s", msg.topic)
|
86
87
|
if self._message_callback:
|
87
88
|
properties = msg.properties.__dict__ if hasattr(msg, 'properties') else {}
|
88
89
|
if "UserProperty" in properties:
|
@@ -14,6 +14,8 @@ num-traits = "0.2.19"
|
|
14
14
|
tokio = { version = "1", features = ["full"] }
|
15
15
|
serde = { version = "1.0.219", features = ["derive"] }
|
16
16
|
serde_json = "1.0.142"
|
17
|
+
log = "0.4"
|
18
|
+
env_logger = "0.10"
|
17
19
|
|
18
20
|
[dependencies.uuid]
|
19
21
|
version = "1.2.1"
|
@@ -24,4 +26,4 @@ features = [
|
|
24
26
|
]
|
25
27
|
[[example]]
|
26
28
|
name = "{{stinger.name | snake_case}}_client_demo"
|
27
|
-
path = "examples/client.rs"
|
29
|
+
path = "examples/client.rs"
|
@@ -13,6 +13,8 @@ num-traits = "0.2.19"
|
|
13
13
|
tokio = { version = "1", features = ["full"] }
|
14
14
|
serde = { version = "1.0.219", features = ["derive"] }
|
15
15
|
serde_json = "1.0.142"
|
16
|
+
log = "0.4"
|
17
|
+
env_logger = "0.10"
|
16
18
|
|
17
19
|
[[example]]
|
18
20
|
name = "{{stinger.name | snake_case}}_server_demo"
|
@@ -33,6 +33,10 @@ fn {{method_name|snake_case}}_handler({%for arg in method.arg_list%}_{{arg.name|
|
|
33
33
|
|
34
34
|
#[tokio::main]
|
35
35
|
async fn main() {
|
36
|
+
env_logger::Builder::from_default_env()
|
37
|
+
.target(env_logger::Target::Stdout)
|
38
|
+
.init();
|
39
|
+
|
36
40
|
block_on(async {
|
37
41
|
{%set broker = stinger.get_example_broker()%}
|
38
42
|
let mut connection = MqttierClient::new("localhost", 1883, None).unwrap();
|
@@ -50,13 +50,13 @@ struct {{stinger.name | UpperCamelCase}}Properties {
|
|
50
50
|
}
|
51
51
|
{%endif%}
|
52
52
|
{%endif%}{# any methods or properties #}
|
53
|
-
|
53
|
+
#[derive(Clone)]
|
54
54
|
pub struct {{stinger.rust.server_struct_name}} {
|
55
55
|
mqttier_client: MqttierClient,
|
56
56
|
{%if stinger.methods|length > 0 or stinger.properties|length > 0 %}
|
57
57
|
/// Temporarily holds the receiver for the MPSC channel. The Receiver will be moved
|
58
58
|
/// to a process loop when it is needed. MQTT messages will be received with this.
|
59
|
-
msg_streamer_rx: Option<mpsc::Receiver<ReceivedMessage
|
59
|
+
msg_streamer_rx: Arc<Mutex<Option<mpsc::Receiver<ReceivedMessage>>>>,
|
60
60
|
|
61
61
|
/// The Sender side of MQTT messages that are received from the broker. This tx
|
62
62
|
/// side is cloned for each subscription made.
|
@@ -133,7 +133,7 @@ impl {{stinger.rust.server_struct_name}} {
|
|
133
133
|
{{stinger.rust.server_struct_name}} {
|
134
134
|
mqttier_client: connection.clone(),
|
135
135
|
{%if stinger.methods|length > 0 or stinger.properties|length > 0 %}
|
136
|
-
msg_streamer_rx: Some(message_received_rx),
|
136
|
+
msg_streamer_rx: Arc::new(Mutex::new(Some(message_received_rx))),
|
137
137
|
msg_streamer_tx: message_received_tx,{%if stinger.methods | length > 0 %}
|
138
138
|
method_handlers: method_handlers,{%endif%}{%if stinger.properties | length > 0 %}
|
139
139
|
properties: property_values,{%endif%}
|
@@ -151,7 +151,7 @@ impl {{stinger.rust.server_struct_name}} {
|
|
151
151
|
{{arg.name}}: {{arg.name|snake_case}},
|
152
152
|
{%endfor%}
|
153
153
|
};
|
154
|
-
let _ = self.mqttier_client.
|
154
|
+
let _ = self.mqttier_client.publish_structure("{{sig.topic}}".to_string(), &data).await;
|
155
155
|
}
|
156
156
|
{%endfor%}
|
157
157
|
|
@@ -199,6 +199,7 @@ impl {{stinger.rust.server_struct_name}} {
|
|
199
199
|
let new_data = {{prop_name | UpperCamelCase}}Property {
|
200
200
|
{{prop.arg_list[0].name}}: data,
|
201
201
|
};
|
202
|
+
println!("Publishing to topic {}", topic);
|
202
203
|
let _pub_result = publisher.publish_state(topic, &new_data, 1).await;
|
203
204
|
{%else%}
|
204
205
|
let _pub_result = publisher.publish_state(topic, &data, 1).await;
|
@@ -254,7 +255,9 @@ impl {{stinger.rust.server_struct_name}} {
|
|
254
255
|
|
255
256
|
{%if stinger.methods|length > 0 or stinger.properties|length > 0 %}
|
256
257
|
// Take ownership of the RX channel that receives MQTT messages. This will be moved into the loop_task.
|
257
|
-
let mut message_receiver =
|
258
|
+
let mut message_receiver = {
|
259
|
+
self.msg_streamer_rx.lock().unwrap().take().expect("msg_streamer_rx should be Some")
|
260
|
+
};
|
258
261
|
|
259
262
|
{%if stinger.methods|length > 0 -%}
|
260
263
|
let mut method_handlers = self.method_handlers.clone();
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|