can_messenger 1.0.0 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d26615bdfc66cb0379649692d151278aea8056338510b2d73f144f9d0fe0fe4
4
- data.tar.gz: 1259bc700f8adf69e1de5f73cdd1dcbef783612b081be9757a31e918855e1b2a
3
+ metadata.gz: c3c1f6bf2353eb4b67b93f9aa9e167a4474b8c65cc1abe2327b520d04695cec2
4
+ data.tar.gz: 6afe7242348e786084de8c6d8afe25f18727ac57b2eeea727518ddd77d53330a
5
5
  SHA512:
6
- metadata.gz: a79e6a61508e0915d1b52e2e31c1b7104597c46db9d21c838952acac87060efe88fb4914d9ad64e4ac7c63287ef32a8b0a927f4b494c0212aed95cdd198ff693
7
- data.tar.gz: 61904213c26ef9b468a4083af58cbf00c95102b5ee841a943b3e559504d324234d3b57d3a1b99a829141a0f629705c6b3240e7d02f8f0081d004b86684088459
6
+ metadata.gz: 7cd537434d6c9f0d41a6a9ad6dd37229bb569057d9b9e259ac301792e71b629df1b66f2ece6c3d5606e7224410d4f42d1c2488894f5341faecb551e46b222140
7
+ data.tar.gz: 18620bf7cc07a7694438b0e3da277a3b96d4767cb87d36c5310920dbce5976cc21971e4c3e572869c99ee3a37a7eac7e9996f7948f2d5d2001875b9dead5f4c1
data/README.md CHANGED
@@ -103,6 +103,48 @@ To stop listening, use:
103
103
  messenger.stop_listening
104
104
  ```
105
105
 
106
+ ## Important Considerations
107
+
108
+ Before using `can_messenger`, please note the following:
109
+
110
+ - **Environment Requirements:**
111
+
112
+ - **Permissions:** Working with raw sockets may require elevated privileges or membership in a specific group to open and bind to CAN interfaces without running as root.
113
+
114
+ - **API Changes (v1.0.0 and later):**
115
+
116
+ - **Keyword Arguments:** The Messenger API now requires keyword arguments. For example, when initializing the Messenger, use:
117
+ ```ruby
118
+ messenger = CanMessenger::Messenger.new(interface_name: 'can0')
119
+ ```
120
+ Similarly, methods like `send_can_message` now require named parameters:
121
+ ```ruby
122
+ messenger.send_can_message(id: 0x123, data: [0xDE, 0xAD, 0xBE, 0xEF])
123
+ ```
124
+ If you're upgrading from an earlier version, update your code accordingly.
125
+ - **Block Requirement for `start_listening`:**
126
+ The `start_listening` method now requires a block. If no block is provided, the method logs an error and exits without processing messages. Ensure you pass a block to handle incoming CAN messages:
127
+ ```ruby
128
+ messenger.start_listening do |message|
129
+ # Process the message here
130
+ puts "Received: #{message}"
131
+ end
132
+ ```
133
+
134
+ - **Threading & Socket Management:**
135
+
136
+ - **Blocking Behavior:** The gem uses blocking socket calls and continuously listens for messages. Be sure to manage the listener's lifecycle appropriately,especially if using it in a multi-threaded application. Always call `stop_listening` to gracefully shut down the listener.
137
+ - **Resource Cleanup:** The socket is automatically closed when the listening loop terminates. However, you should ensure that your application stops the listener to avoid resource leaks.
138
+
139
+ - **Logging:**
140
+
141
+ - **Default Logger:** By default, if no logger is provided, the gem logs to standard output. For more controlled logging, pass a custom logger when initializing the Messenger.
142
+
143
+ - **CAN Frame Format Assumptions:**
144
+ - The gem expects a standard CAN frame format with a minimum frame size and specific layout (e.g., the first 4 bytes for the CAN ID, followed by a byte indicating data length, etc.). If you work with non-standard frames, you may need to adjust the implementation.
145
+
146
+ By keeping these points in mind, you can avoid common pitfalls and ensure that `can_messenger` is integrated smoothly into your project.
147
+
106
148
  ## Features
107
149
 
108
150
  - **Send CAN Messages**: Send CAN messages with a specified ID.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CanMessenger
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_messenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fk1018