Comments (4)
Sounds good, you can go ahead and do this change. A few things to keep in mind
- The logic that decides if a mac is allowed or not should be kept separate (like it is now in Config), to support #26
- Try not to make unnecessary changes on the "existing flow", as I have support for "multiple simultaneous inputs and outputs" in progress, which will do some changes to the flow, mainly extracting some of the logic from the Main to separate classes as-is to better support that use-case
from ruuvicollector.
If you are actively refactoring main - its probably easier to wait rather than have to handle merge conflicts :)
I also wonder if it would be simplier for the code to read the whole payload (both lines) before handing off to the parsers. Rather than consuming the first part, maintaining state and getting the second message, updating the data object - then processing to an onward store/DB. 🤔
from ruuvicollector.
I'm not touching the main at the moment (apart from testing changes), I'm developing a http-gateway input feature in completely separate classes. Once that's done I know which parts of the current hcidump input feature it actually overlaps with and I will then split the relevant parts accordingly to their own respective classes. At the current amount of free time I have for this project this will be relatively far in the future.
Regarding the parser, it needs to be more or less a state machine anyway, as some of the structural information (such as report and AD counts and lengths) are not known until you've already parsed up to the point where they are declared, so I figured it could as well parse the input in pieces to avoid the need of manually stitching the lines together beforehand. It wouldn't be thread-safe anyway, so parsing in pieces makes no difference in that. I was actually initially considering creating the parser with java.io.Reader
/java.io.Writer
, but then decided not to, as it wouldn't really bring any benefit in the current use-case.
Another issue in stitching the lines is that you don't know how many lines there will be without starting to parse the packet and figure the lengths, so you'd need to wait for the next new packet (a line starting with >
or <
) which will cause an unnecessary delay (and thus skew the measurement timestamp), especially in setups where packets come in at much longer intervals.
from ruuvicollector.
Had an attempt at this - let me know if I have missed anything :)
from ruuvicollector.
Related Issues (20)
- Feature: INVALID values should be stored as null HOT 2
- RuuviCollector gives up after BT HW error HOT 5
- Feature request/idea: Offset values to collected measurements HOT 1
- How to enable changes in ruuvi-names.properties correctly? HOT 1
- raw packet storing HOT 4
- BUG: No data received anymore from Ruuvitags after apt-get update/upgrade HOT 1
- Calibration of Temp and Humidity in Ruuvi Collector? HOT 4
- BUG:named-filter does not recognise ruuvi-names.properties HOT 1
- Feature request/idea: TagSocket support HOT 1
- BUG: java.net.UnknownHostException: <domain> HOT 7
- Feature request/idea: Insert to two influxUrl's HOT 3
- Feature request/idea: put receiver MAC or other unique identifier as tag
- Feature request/idea: temperatureOffset.MAC=nn HOT 5
- Feature request/idea: InfluxDB2 support HOT 3
- I am beginner programmer, but wanting to contribute HOT 3
- Exit uncleanly when database connection is lost HOT 6
- BLE scanning service HOT 1
- Humidity Conversion Formula -broken link -fix provided
- Feature request/idea: replace deprecated hcitool/hcidump
- BUG: Capabilties are not enough after raspberry pi os 12/2022 updates HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruuvicollector.