diff --git a/RevidCLI.go b/RevidCLI.go index 3677c57f..ca50f0e7 100644 --- a/RevidCLI.go +++ b/RevidCLI.go @@ -213,9 +213,11 @@ func main() { } func netsenderInit() { + //initialize netsender and assign function to check X pins netsender.InitRevidNetsender() netsender.ExternalReader = revidReportActions + //try get initial config if err := netsender.GetConfig(); err != nil { //default to a config????? config.Logger.Log("Error", err.Error()) @@ -224,6 +226,8 @@ func netsenderInit() { } } +//periodicNetsenderReport is called by the main function every monPeriod seconds. It makes sure a config has been recieved, and then +//reports back CPU stats and updates vars func periodicNetsenderReport(){ if !configReceived { if err := netsender.GetConfig(); err != nil { @@ -253,9 +257,11 @@ func periodicNetsenderReport(){ } } + func updateRevid() { revidInst.Stop() time.Sleep( time.Duration(revidStopTime) * time.Second ) + //look through var map and update revid where needed for key, value := range vars { switch key { case "FramesPerClip": @@ -357,6 +363,7 @@ func revidReportActions(pin int) (int, error) { // return int(val), nil // } + //function to measure temp of cpu case pin == cpuTemp: var out []byte var err error @@ -368,7 +375,7 @@ func revidReportActions(pin int) (int, error) { return -1, errors.New("CPU Temp Read Err: " + err.Error()) } return int(val), nil - + //function to measure usage of cpu case pin == cpuUsage: stat, err := linuxproc.ReadStat("/proc/stat") if err != nil { @@ -398,7 +405,7 @@ func revidReportActions(pin int) (int, error) { // return int(processManager.PriorityLevel), nil default: - return -1, errors.New("External pin not defined") + return -1, errors.New("External pin" + pin + " not defined") } }