You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DSI e-BRAIN (protocol 7) uses 5 minute intervals relative to the current date of the device time as the event time. This means that if the device time is midnight, and the event if at 00:15, the calendar event time is sent as "3". If the event is midnight on the next day, it is sent as "288" (1440 minutes in a day / 5 minutes).
Since this is relative to the device time, if a calendar event happens to be before the device time, then this method will produce negative values in its array of bytes:
When this happens, this exception is seen when attempting a transfer:
/home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:35:in `chr': -261 out of char range (RangeError)
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:35:in `block (2 levels) in write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:32:in `each'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:32:in `block in write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:31:in `each'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:31:in `write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client.rb:113:in `write'
from ebrain.ruby:111:in `<main>'
Since it is not possible to transfer calendar events in the past on protocol 7 due to the relative time comparison, an ActiveModel validation should be added to protocol 7's Eeprom::Calendar::Event. This will ensure that invalid data is not passed to protocol 7's Eeprom, and ultimately causing exceptions when attempting to pass negative values to TimexDatalinkClient::NotebookAdapter.
The text was updated successfully, but these errors were encountered:
Related to #316.
The DSI e-BRAIN (protocol 7) uses 5 minute intervals relative to the current date of the device time as the event time. This means that if the device time is midnight, and the event if at 00:15, the calendar event time is sent as "3". If the event is midnight on the next day, it is sent as "288" (1440 minutes in a day / 5 minutes).
Since this is relative to the device time, if a calendar event happens to be before the device time, then this method will produce negative values in its array of bytes:
timex_datalink_client/lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb
Lines 26 to 32 in f80d9d1
When this happens, this exception is seen when attempting a transfer:
Since it is not possible to transfer calendar events in the past on protocol 7 due to the relative time comparison, an ActiveModel validation should be added to protocol 7's Eeprom::Calendar::Event. This will ensure that invalid data is not passed to protocol 7's Eeprom, and ultimately causing exceptions when attempting to pass negative values to TimexDatalinkClient::NotebookAdapter.
The text was updated successfully, but these errors were encountered: