コード例 #1
0
 public void Setup(int mode, string config)
 {
     if (opt != null)
     {
         opt.ReleaseSerialPort();
     }
     opt         = new OPTControllerAPI();
     this.Mode   = mode;
     this.Config = config;
 }
コード例 #2
0
        public static void Turn_On_LED(String IPAddr, Int32 channel, int intensity)
        {
            long             lRet          = -1;
            OPTControllerAPI OPTController = new OPTControllerAPI();

            if (IPAddr == "")
            {
                Console.WriteLine("\nIP Address is not regular!");
                return;
            }
            lRet = OPTController.CreateEtheConnectionByIP(IPAddr);
            if (lRet != 0)
            {
                Console.WriteLine("\nFail to connect by IP");
                return;
            }
            else
            {
                if (OPTController.TurnOnChannel(channel) == 0)
                {
                    Console.WriteLine("\nChannel Turned On successfully!");
                    if (OPTController.SetIntensity(channel, intensity) == 0)
                    {
                        Console.WriteLine("Set intensity successfully");
                    }
                    else
                    {
                        Console.WriteLine("Fail to set intensity");
                        return;
                    }
                }
                else
                {
                    Console.WriteLine("\nChannel Failed to Turned on!");
                    return;
                }
                lRet = OPTController.DestoryEtheConnect();
                if (0 != lRet)
                {
                    Console.WriteLine("Failed to disconnect Ethernet connection by IP");
                    return;
                }
                else
                {
                    Console.WriteLine("Successfully disconnected Ethernet connection by IP");
                }
            }
            return;
        }
コード例 #3
0
 /// <summary>
 /// OPT光源构造函数
 /// </summary>
 /// <param name="mode">0:串口连接,1:IP地址连接,2:SN连接</param>
 /// <param name="config">对应串口号,IP地址,SN序列号三种连接方式</param>
 public LightingOPT(int mode, string config)
 {
     opt         = new OPTControllerAPI();
     this.Mode   = mode;
     this.Config = config;
 }
コード例 #4
0
 public LightingOPT()
 {
     opt = new OPTControllerAPI();
 }