Created
April 17, 2020 03:11
-
-
Save BenJuan26/bb778810566e8285018aa3e9d4a8f24d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func checkStatusAndUpdate() error { | |
| s, err = getSerialPort(getPNPDeviceID()) | |
| if err != nil { | |
| return err | |
| } | |
| status, err := elite.GetStatusFromPath(filepath.FromSlash(getLogDir())) | |
| if err != nil { | |
| return err | |
| } | |
| // Only send the data if it has changed. | |
| if status.Timestamp != lastStatus.Timestamp { | |
| infoBytes, err := json.Marshal(status) | |
| if err != nil { | |
| return err | |
| } | |
| _, err = s.Write(infoBytes) | |
| if err != nil { | |
| return err | |
| } | |
| } | |
| return nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment