public override void Get() { try { switch (Request.PathArguments["method"]) { case "bootprogress": var response = new { @booted = System.Booted, @restartpending = System.WillRestart, @progress = System.BootProgressPercent, @status = System.BootStatus }; WriteResponse(response); break; case "version": var roomName = "CONFIG ERROR"; if (System.Rooms.Any()) { roomName = System.Rooms.First().Name; } var versionResponse = new { @version = System.Version.ToString(), @name = System.VersionName, @type = System.SystemTypeInfo, @room = roomName }; WriteResponse(versionResponse); break; case "memory": WriteResponse(new { @percent = SystemMonitor.RamUsedPercent, @total = SystemMonitor.TotalRamSize, @used = SystemMonitor.RamUsed, @free = SystemMonitor.RamFree, @free_min = SystemMonitor.RamFreeMinimum }); break; case "cpu": WriteResponse(new { @cpu_load = SystemMonitor.CpuUtilization, @cpu_max = SystemMonitor.CpuMaxUtilization, @cpu_max_margin = SystemMonitor.CpuMaxUtilization - SystemMonitor.CpuUtilization }); break; case "logs": var logs = CloudLog.GetSystemLogs().ToArray(); var logResponse = new { count = logs.Length, errorCount = logs.Count(l => l.Level >= LoggingLevel.Error), warningCount = logs.Count(l => l.Level == LoggingLevel.Warning), logs }; WriteResponse(logResponse); break; case "avstatus": var rooms = new JArray(); foreach (var room in System.Rooms) { var sources = new JArray(); foreach (var source in room.Sources) { var s = new JObject(); s["id"] = source.Id; s["name"] = source.Name; s["type"] = source.Type.ToString(); s["icon_name"] = source.IconName; s["icon_svg"] = source.GenerateIconData(); s["availability"] = source.AvailabilityType.ToString(); s["active"] = room.Source == source; sources.Add(s); } var r = new JObject(); r["id"] = room.Id; r["screen_name"] = room.Name; r["name"] = room.NameFull; r["location"] = room.Location; r["contact_number"] = room.RoomContactNumber; r["sources"] = sources; rooms.Add(r); } WriteResponse(new { rooms }); break; default: HandleNotFound(); break; } } catch (Exception e) { HandleError(e); } }