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 +4 -4
- data/README.md +42 -0
- data/lib/can_messenger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3c1f6bf2353eb4b67b93f9aa9e167a4474b8c65cc1abe2327b520d04695cec2
|
4
|
+
data.tar.gz: 6afe7242348e786084de8c6d8afe25f18727ac57b2eeea727518ddd77d53330a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|