Created
September 11, 2024 09:14
-
-
Save ramonsmits/aa00d7ee6d3c1368c7d6d101d5c784f6 to your computer and use it in GitHub Desktop.
Motorola FLEX pager protocol calculate hourly offset based on cycles/frames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FLEX|2024-09-05 15:22:37|1600/2/K/A|05.105|002029569 000123126 000126999|ALN|A2 11126 Rit 126665 VWS Wormerveer Industrieweg Wormerveer | |
const int framesPerHour = 15 * 128; | |
const int millisecondsInFrame = 3600_000 / framesPerHour; | |
var segments = l.Split('|'); | |
var values = segments[3].Split("."); | |
var cycle = int.Parse(values[0]); | |
var frame = int.Parse(values[1]); | |
var frames = cycle * 128 + frame; | |
var total = frames * millisecondsInFrame; | |
var hourOffset = TimeSpan.FromMilliseconds(total); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment