Exemplo n.º 1
0
        static int Main(string[] args)
        {
            var device = new Shelly3EM();

            Console.WriteLine(device.GetEmeterData(0, out var data) ? data.ToString() : "");
            Console.WriteLine(device.GetEmeterData(1, out data) ? data.ToString() : "");
            Console.WriteLine(device.GetEmeterData(2, out data) ? data.ToString() : "");

            return(0);

            // // Create a root command with some option
            // var rootCommand = new RootCommand {
            //     new Option<int>(
            //         "--int-option",
            //         getDefaultValue: () => 42,
            //         description: "An option whose argument is parsed as an int"),
            //     new Option<bool>(
            //         "--bool-option",
            //         "An option whose argument is parsed as a bool"),
            //     new Option<FileInfo>(
            //         "--file-option",
            //         "An option whose argument is parsed as a FileInfo")
            // };

            // rootCommand.Description = "My sample app";

            // // Note that the parameters of the handler method are matched according to the names of the options
            // rootCommand.Handler = CommandHandler.Create<int, bool, FileInfo>((intOption, boolOption, fileOption) =>
            //  {
            //      Console.WriteLine($"The value for --int-option is: {intOption}");
            //      Console.WriteLine($"The value for --bool-option is: {boolOption}");
            //      Console.WriteLine($"The value for --file-option is: {fileOption?.FullName ?? "null"}");
            //  });

            // // Parse the incoming args and invoke the handler
            // return rootCommand.InvokeAsync(args).Result;
        }
Exemplo n.º 2
0
        public void GetEmeterData_RealDevice_Test()
        {
            var device = new Shelly3EM();

            device.GetEmeterData(0, out var data);
        }