Beispiel #1
0
        public async static Task <SerialNumberMapper> DetectDevices()
        {
            var logLevel = File.Exists("IO.conf") ? IOconfFile.GetOutputLevel() : CALogLevel.Normal;
            var boards   = await Task.WhenAll(RpiVersion.GetUSBports().Select(name => AttemptToOpenDeviceConnection(name, logLevel)));

            return(new SerialNumberMapper(boards));
        }
        public static string GetWelcomeMessage(string purpose, string i2cConfig = null)
        {
            var sb = new StringBuilder();

            sb.AppendLine("This is Open Source code by Copenhagen Atomics");
            sb.AppendLine(purpose);
            sb.AppendLine();
            if (IOconfFile.GetOutputLevel() == CALogLevel.Debug)
            {
                sb.AppendLine("UTC time now: " + DateTime.UtcNow.ToString("ddd MMM dd. HH:mm:ss"));
                sb.AppendLine(GetSoftware());
                sb.AppendLine(GetHardware(i2cConfig));
                sb.AppendLine();
            }
            sb.AppendLine("Press ESC to stop");
            sb.AppendLine();
            return(sb.ToString());
        }