コード例 #1
0
        void monitoringLogEx(IntPtr sdkContext, UInt32 deviceID, bool isMasterDevice)
        {
            cbOnLogReceived   = null;
            cbOnLogReceivedEx = new API.OnLogReceivedEx(RealtimeLogReceivedEx);
            Console.WriteLine("Trying to activate log monitoringEx.");
            BS2ErrorCode result = (BS2ErrorCode)API.BS2_StartMonitoringLogEx(sdkContext, deviceID, cbOnLogReceivedEx);

            if (result != BS2ErrorCode.BS_SDK_SUCCESS)
            {
                Console.WriteLine("Got error({0}).", result);
            }

            Console.WriteLine("Press ESC to stop log monitoring.");
            while (Console.ReadKey(true).Key != ConsoleKey.Escape)
            {
                Thread.Sleep(100);
            }

            Console.WriteLine("Trying to deactivate log monitoring.");
            result = (BS2ErrorCode)API.BS2_StopMonitoringLog(sdkContext, deviceID);
            if (result != BS2ErrorCode.BS_SDK_SUCCESS)
            {
                Console.WriteLine("Got error({0}).", result);
            }

            cbOnLogReceivedEx = null;
        }
コード例 #2
0
        void monitoringLog(IntPtr sdkContext, UInt32 deviceID, bool isMasterDevice)
        {
            Console.WriteLine("Do you want to display the temperature in the real-time log? [y/n]");
            if (Util.IsYes())
            {
                monitoringLogEx(sdkContext, deviceID, isMasterDevice);
                return;
            }

            cbOnLogReceivedEx = null;
            cbOnLogReceived   = new API.OnLogReceived(RealtimeLogReceived);
            Console.WriteLine("Trying to activate log monitoring.");
            BS2ErrorCode result = (BS2ErrorCode)API.BS2_StartMonitoringLog(sdkContext, deviceID, cbOnLogReceived);

            if (result != BS2ErrorCode.BS_SDK_SUCCESS)
            {
                Console.WriteLine("Got error({0}).", result);
            }

            Console.WriteLine("Press ESC to stop log monitoring.");
            while (Console.ReadKey(true).Key != ConsoleKey.Escape)
            {
                Thread.Sleep(100);
            }

            Console.WriteLine("Trying to deactivate log monitoring.");
            result = (BS2ErrorCode)API.BS2_StopMonitoringLog(sdkContext, deviceID);
            if (result != BS2ErrorCode.BS_SDK_SUCCESS)
            {
                Console.WriteLine("Got error({0}).", result);
            }

            cbOnLogReceived = null;
        }