stinger-ipc 0.0.8__tar.gz → 0.0.10__tar.gz

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.
Files changed (68) hide show
  1. {stinger_ipc-0.0.8/stinger_ipc.egg-info → stinger_ipc-0.0.10}/PKG-INFO +1 -1
  2. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/pyproject.toml +1 -1
  3. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10/stinger_ipc.egg-info}/PKG-INFO +1 -1
  4. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/connection.py.jinja2 +2 -1
  5. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/client/Cargo.toml.jinja2 +3 -1
  6. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/server/Cargo.toml.jinja2 +2 -0
  7. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/server/examples/server.rs.jinja2 +4 -0
  8. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/server/src/lib.rs.jinja2 +8 -5
  9. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/LICENSE +0 -0
  10. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/README.md +0 -0
  11. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/setup.cfg +0 -0
  12. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stinger_ipc.egg-info/SOURCES.txt +0 -0
  13. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stinger_ipc.egg-info/dependency_links.txt +0 -0
  14. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stinger_ipc.egg-info/entry_points.txt +0 -0
  15. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stinger_ipc.egg-info/requires.txt +0 -0
  16. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stinger_ipc.egg-info/top_level.txt +0 -0
  17. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/__init__.py +0 -0
  18. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/args.py +0 -0
  19. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/asyncapi.py +0 -0
  20. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/components.py +0 -0
  21. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/connection.py +0 -0
  22. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/exceptions.py +0 -0
  23. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/interface.py +0 -0
  24. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/lang_symb.py +0 -0
  25. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/CMakeLists.txt.jinja2 +0 -0
  26. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/examples/client_main.cpp.jinja2 +0 -0
  27. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/examples/server_main.cpp.jinja2 +0 -0
  28. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/broker.hpp.jinja2 +0 -0
  29. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/client.hpp.jinja2 +0 -0
  30. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/enums.hpp.jinja2 +0 -0
  31. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/ibrokerconnection.hpp.jinja2 +0 -0
  32. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/property_structs.hpp.jinja2 +0 -0
  33. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/return_types.hpp.jinja2 +0 -0
  34. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/server.hpp.jinja2 +0 -0
  35. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/include/structs.hpp.jinja2 +0 -0
  36. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/src/broker.cpp.jinja2 +0 -0
  37. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/src/client.cpp.jinja2 +0 -0
  38. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/cpp/src/server.cpp.jinja2 +0 -0
  39. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/html/app.js.jinja2 +0 -0
  40. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/html/index.html.jinja2 +0 -0
  41. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/html/styles.css.jinja2 +0 -0
  42. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/markdown/index.md.jinja2 +0 -0
  43. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/__init__.py.jinja2 +0 -0
  44. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/client.py.jinja2 +0 -0
  45. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/interface_types.py.jinja2 +0 -0
  46. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/method_codes.py.jinja2 +0 -0
  47. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/pyproject.toml.jinja2 +0 -0
  48. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/python/server.py.jinja2 +0 -0
  49. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/Cargo.toml.jinja2 +0 -0
  50. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/client/examples/client.rs.jinja2 +0 -0
  51. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/client/src/lib.rs.jinja2 +0 -0
  52. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/payloads/Cargo.toml.jinja2 +0 -0
  53. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/payloads/examples/pub_and_recv.rs.jinja2 +0 -0
  54. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/payloads/src/handler.rs.jinja2 +0 -0
  55. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/payloads/src/lib.rs.jinja2 +0 -0
  56. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/templates/rust/payloads/src/payloads.rs.jinja2 +0 -0
  57. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/tools/__init__.py +0 -0
  58. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/tools/cli.py +0 -0
  59. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/tools/markdown_generator.py +0 -0
  60. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/tools/python_generator.py +0 -0
  61. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/tools/rust_generator.py +0 -0
  62. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/stingeripc/topic.py +0 -0
  63. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_args.py +0 -0
  64. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_enum.py +0 -0
  65. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_examples.py +0 -0
  66. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_interface.py +0 -0
  67. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_signal.py +0 -0
  68. {stinger_ipc-0.0.8 → stinger_ipc-0.0.10}/tests/test_topics.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stinger-ipc
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: Tools to create code to do IPC over MQTT
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stinger-ipc"
3
- version = "0.0.8"
3
+ version = "0.0.10"
4
4
  description = "Tools to create code to do IPC over MQTT"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stinger-ipc
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: Tools to create code to do IPC over MQTT
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -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.publish_state("{{sig.topic}}".to_string(), &data, 1).await;
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 = self.msg_streamer_rx.take().expect("msg_streamer_rx should be Some");
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