예제 #1
0
        static async Task Main(string[] args)
        {
            System.Console.WriteLine("Hello World!");

            var logger = new ConsoleLoggerProvider((s, level) => true, true).CreateLogger("test");

            var driver = new BaosDriver("/dev/ttyAMA0", logger, new DataReceiver(logger));

            await driver.Start();

            //var desc = await driver.GetDatapointDescriptions();

            logger.LogDebug($"GetDpValues...");
            var data = await driver.GetDatapointValue(1, 1);

            logger.LogDebug($"GetDpValues...done");


            logger.LogDebug($"setDpValue...");
            var data1 = await driver.GetDatapointValue(2, 1);

            //var sendData = await driver.SetDatapointValue(1, new byte[] { 0x00 });
            logger.LogDebug($"setDpValue...done");

            System.Console.ReadLine();

            await driver.Stop();
        }
예제 #2
0
        public async Task <bool> Read(string address)
        {
            var dpValue = await _driver.GetDatapointValue(Convert.ToInt16(address), 1);

            if (dpValue != null)
            {
                await DatapointInd(dpValue);

                return(true);
            }
            return(false);
        }