Skip to content

Feature/annotation#134

Merged
JordanYates merged 2 commits into
mainfrom
feature/annotation
Apr 20, 2026
Merged

Feature/annotation#134
JordanYates merged 2 commits into
mainfrom
feature/annotation

Conversation

@Aeyohan
Copy link
Copy Markdown
Contributor

@Aeyohan Aeyohan commented Apr 16, 2026

Add annotate RPC wrapper
Add annotate events tool

  • Connects to tag
  • Syncs time (if required/requested, based on args)
  • Prompts user for label from user-defined labels
  • Or prompts user for a custom label
  • Send annotate RPC.

Closes on tag disconnect (reconnecting and handling input was not working as intended).

@Aeyohan Aeyohan force-pushed the feature/annotation branch 3 times, most recently from e6a9fcb to a59cd08 Compare April 16, 2026 05:33
@Aeyohan Aeyohan requested a review from JordanYates April 16, 2026 05:54
Comment thread src/infuse_iot/rpc_wrappers/annotate.py Outdated

def request_struct(self):
timestamp = InfuseTime.gps_seconds_from_unix(int(self.time.timestamp()))
return self.annotate_value_factory(self.logger, timestamp, self.label)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request_struct can return a bytes object directly, so the whole thing can be simplified to:

 return self.request(self.logger, timestamp) + self.label.encode('utf-8') + "\x00"

I do need to update the types of InfuseRpcCommand to show that works though

Copy link
Copy Markdown
Contributor Author

@Aeyohan Aeyohan Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially replaced with return self.request(self.logger, timestamp) + self.label.encode('utf-8') + "\x00" but then realised this is duplicated in the annotate_events.py. (Constructing a whole InfuseRpcCommand seemed annoying compared to just having a static helper function).

As a result, I've kept self.annotate_factory and instead moved this there, since it can be used by annotate_events.py or other tools and reduces the likelihood of messing up elsewhere.

I think typing isn't happy about this till the other PR is merged.

Comment thread src/infuse_iot/tools/annotate_events.py Outdated
Comment thread src/infuse_iot/tools/annotate_events.py Outdated
@Aeyohan Aeyohan force-pushed the feature/annotation branch 3 times, most recently from 76b70f5 to 5bb5e46 Compare April 17, 2026 05:18
Aeyohan added 2 commits April 17, 2026 15:24
Added an annotation rpc wrapper to log an annotation tdf on device.
Use `--string STRING` to specify the annotation label.
Specify which logger to use with one of `--onboard`, `--external`, or
`--logger`/`-l` and the logger ID/Name.
Specify the time of the event with one of `--now`/`-n`, `--timestamp`/
`-t` with an ISO formatted timestamp, or `--delta`/`-d` with a delta in
seconds from the current time.

Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
Added annotation tool that can be used to log events.
Configure whether the tool should update the tag's time.
Supply a label file (or labels at runtime) and then select a label from
the list to annotate the vent.
Otherwise, type a custom event label to be sent to the tag.
usage `infuse annotate_events --help` for more details.

Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
@Aeyohan Aeyohan force-pushed the feature/annotation branch from 5bb5e46 to beea447 Compare April 17, 2026 05:25
@Aeyohan
Copy link
Copy Markdown
Contributor Author

Aeyohan commented Apr 17, 2026

  • Addressed requested changes.
  • Simplified some of the exit logic.
  • Fixed formatting & imports.

@Aeyohan Aeyohan requested a review from JordanYates April 17, 2026 06:01
@JordanYates JordanYates merged commit 1a29ccd into main Apr 20, 2026
7 checks passed
@JordanYates JordanYates deleted the feature/annotation branch April 20, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants