private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(WorkFile) && System.IO.File.Exists(WorkFile))
            {
                GeneralHelper.ResetChannelList();
            }
            else
            {
                if (DMXConfigurationFile.Current.Definitions.Count == 0)
                {
                    DoConfiguration();
                }
            }
            try
            {
                if (!InTestMode)
                {
                    OpenDMX.Start();
                }
            }
            catch (Exception ex)
            {
                if (_log.IsErrorEnabled)
                {
                    _log.Error("Error opening DMX Device:", ex);
                }
                MessageBox.Show("There was an error starting the DMX Device.\r\nYou will need to restart this application to get it to work with your device after you fix the issue.\r\n\r\nError:\r\n\r\n" + ex.Message,
                                "DMX Commander", MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }
        }
Exemple #2
0
        private void CosmoColorChange_Click(object sender, RoutedEventArgs e)
        {
            EnttecStatus();

            if (ColorThreadStartet)
            {
                CT.Abort();
                ColorThreadStartet = false;
            }

            var currentLights = GetCurrentLights();

            foreach (var currentLight in currentLights)
            {
                OpenDMX.setDmxValue(currentLight.StartChannel + currentLight.IntensityOffset, 255);

                var red = new BaseClass.Objects.LightDefinitions.Color();
                red.ColorName  = "Red";
                red.ColorValue = 6;
                currentLight.Colors.Add(red);

                var green = new BaseClass.Objects.LightDefinitions.Color();
                green.ColorName  = "Green";
                green.ColorValue = 15;
                currentLight.Colors.Add(green);

                var blue = new BaseClass.Objects.LightDefinitions.Color();
                blue.ColorName  = "Blue";
                blue.ColorValue = 20;
                currentLight.Colors.Add(blue);
            }

            CosmoColorChange = true;
            CosmoColorChangeShow(currentLights);
        }
Exemple #3
0
        public static void Tilt(byte value)
        {
            var channel = CHANNEL_TILT_VALUE;

            Console.WriteLine(string.Format("TILT [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #4
0
 private void OnDestroy()
 {
     receiver.Stop();
     LEDDataChannel.Close();
     openDMXSO.stop();
     OpenDMX.stop();
 }
Exemple #5
0
        public static void Color(byte value)
        {
            var channel = CHANNEL_COLOR_VALUE;

            Console.WriteLine(string.Format("COLOR [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #6
0
    public void Start()
    {
        try
        {
            OpenDMX.Start();                                           //find and connect to devive (first found if multiple)
            if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)       //update status
            {
                Debug.Log("No Enttec USB Device Found");
            }
            else if (OpenDMX.status == FT_STATUS.FT_OK)
            {
                Debug.Log("Found DMX on USB");
            }
            else
            {
                Debug.Log(OpenDMX.status);
            }
        }
        catch (Exception exp)
        {
            Debug.Log(exp);
            Debug.Log("Error Connecting to Enttec USB Device");
        }

        for (int i = 0; i < _fixtures.Count; i++)
        {
            _fixtures[i].Initialize();
            _universe.AddFixture(_fixtures[i]);
        }

        _universe.StartDataWriter();
    }
Exemple #7
0
        public static void Focus(byte value)
        {
            var channel = CHANNEL_FOCUS_VALUE;

            Console.WriteLine(string.Format("FOCUS [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #8
0
        public void initializeDMX()
        {
            try
            {
                OpenDMX.start();

                if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)
                {
                    mainForm.getConnectionWarningLabel().Visible = true;
                    //Console.WriteLine("Could not find Enttec USB");
                }
                else if (OpenDMX.status == FT_STATUS.FT_OK)
                {
                    //Console.WriteLine("We did it.  We found it.  You are good to go!");
                }
                else
                {
                    mainForm.getConnectionWarningLabel().Visible = true;
                    //Console.WriteLine("Be-atch, this shit ain't workin");
                }
            }
            catch (Exception exp)
            {
                mainForm.getConnectionWarningLabel().Visible = true;
                //Console.WriteLine(exp);
                //Console.WriteLine("This shit encountered a flippy dippy error, gurl!");
            }
        }
Exemple #9
0
        public static void Show2() // Color Change
        {
            while (ShowBool2 == true)
            {
                OpenDMX.setDmxValue(187, 6);

                if (ShowBool2 == false)
                {
                    break;
                }
                Thread.Sleep(1000);
                OpenDMX.setDmxValue(187, 15);

                if (ShowBool2 == false)
                {
                    break;
                }
                Thread.Sleep(1000);
                OpenDMX.setDmxValue(187, 20);

                if (ShowBool2 == false)
                {
                    break;
                }
                Thread.Sleep(1000);
            }
        }
 void TestTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (DMXDeviceEnabled)
     {
         if (Data != null && Data.Definitions != null)
         {
             foreach (ChannelDefinition def in Data.Definitions)
             {
                 //DMXEngine.Current.Write(def.Channel, def.TestValue);
                 OpenDMX.SetDmxValue(def.Channel, def.TestValue);
             }
         }
         else
         {
             StopTimer = true;
         }
     }
     else
     {
         StopTimer = true;
     }
     if (StopTimer)
     {
         TestTimer.Stop();
         TestTimer.Dispose();
         TestTimer = null;
         StopTimer = false;
     }
 }
Exemple #11
0
        public static void ProfilShow2_thread()
        {
            while (true)
            {
                OpenDMX.setDmxValue(Profil1_Color, 255);
                OpenDMX.setDmxValue(Profil1_Strope, 255);
                OpenDMX.setDmxValue(Profil1_Intensity, 255);

                OpenDMX.setDmxValue(Profil1_Pan, 255);
                OpenDMX.setDmxValue(Profil1_Tilt, 255);

                OpenDMX.setDmxValue(Profil2_Color, 255);
                OpenDMX.setDmxValue(Profil2_Strope, 255);
                OpenDMX.setDmxValue(Profil2_Intensity, 255);

                OpenDMX.setDmxValue(Profil2_Pan, 255);
                OpenDMX.setDmxValue(Profil2_Tilt, 255);

                Thread.Sleep(2000);

                OpenDMX.setDmxValue(Profil1_Pan, 0);
                OpenDMX.setDmxValue(Profil1_Tilt, 0);


                OpenDMX.setDmxValue(Profil2_Pan, 0);
                OpenDMX.setDmxValue(Profil2_Tilt, 0);

                Thread.Sleep(2000);
            }
        }
Exemple #12
0
        public static void Zoom(byte value)
        {
            var channel = CHANNEL_ZOOM_VALUE;

            Console.WriteLine(string.Format("ZOOM [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #13
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                OpenDMX.start();
                if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)
                {
                    StatusBox.Text = "No Enttec USB Device Found";
                }
                else if (OpenDMX.status == FT_STATUS.FT_OK)
                {
                    StatusBox.Text = "Found DMX on USB";
                }
                else
                {
                    StatusBox.Text = "Error Opening Device";
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
                StatusBox.Text = "Error Connecting to Enttec USB Device";
            }

            OpenDMX.setDmxValue(174, 255);

            Thread t = new Thread(DataThread);

            t.Start();

            OpenDMX.setDmxValue(1, 255);
        }
Exemple #14
0
 private void BO_Button_Click(object sender, RoutedEventArgs e)
 {
     if (BO == false)
     {
         OpenDMX.setDmxValue(1, 0);
         OpenDMX.setDmxValue(173, 0);
         OpenDMX.setDmxValue(174, 0);
         Show1_Button.IsEnabled = false;
         Show2_Button.IsEnabled = false;
         Show3_Button.IsEnabled = false;
         Show4_Button.IsEnabled = false;
         Show5_Button.IsEnabled = false;
         Show6_Button.IsEnabled = false;
         LED.IsEnabled          = false;
         ShowBool1 = false;
         BO        = true;
     }
     else
     {
         OpenDMX.setDmxValue(174, 255);
         OpenDMX.setDmxValue(1, 255);
         Show1_Button.IsEnabled = true;
         Show2_Button.IsEnabled = true;
         Show3_Button.IsEnabled = true;
         Show4_Button.IsEnabled = true;
         Show5_Button.IsEnabled = true;
         Show6_Button.IsEnabled = true;
         LED.IsEnabled          = true;
         BO = false;
     }
 }
Exemple #15
0
 public static void DataThread()
 {
     while (true)
     {
         OpenDMX.writeData();
         Thread.Sleep(50);
     }
 }
 private IEnumerator WriteData()
 {
     while (true)
     {
         OpenDMX.WriteData();
         yield return(_wait);
     }
 }
Exemple #17
0
        public static void Prism_Frost()
        {
            var  channel = CHANNEL_PRISM_VALUE;
            byte value   = 255;                 // 192 - 255

            Console.WriteLine(string.Format("PRISM FROST [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #18
0
        public static void Prism_8Facet()
        {
            var  channel = CHANNEL_PRISM_VALUE;
            byte value   = 128;                 // 128 - 191

            Console.WriteLine(string.Format("PRISM 8 FACET [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #19
0
 protected void SetDmxValue(int channel, byte value)
 {
     if (channel - 1 >= 0 && channel - 1 < _channels.Length)
     {
         _channels[channel - 1] = value;
         OpenDMX.SetDmxValue(_universeStartIndex + channel, value);
     }
 }
 private void OnClosed(object sender, EventArgs e)
 {
     try
     {
         OpenDMX.Stop();
     }
     catch { }
 }
Exemple #21
0
        public static void Shutter_Close()
        {
            var  channel = CHANNEL_SHUTTER_VALUE;
            byte value   = 0;

            Console.WriteLine(string.Format("SHUTTER CLOSE [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #22
0
        public static void Prism_Open()
        {
            var  channel = CHANNEL_PRISM_VALUE;
            byte value   = 0;                   // 0 - 63

            Console.WriteLine(string.Format("PRISM OPEN [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #23
0
        public static void Lamp_OFF()
        {
            var  channel = CHANNEL_RESET;
            byte value   = 79;                  // range [ 72 - 79 ]

            Console.WriteLine(string.Format("LAMP ON [CHANNEL:{0}] [VALUE:{1}]", channel, value));
            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #24
0
        private void Connect_DMX(object sender, EventArgs e)
        {
            try
            {
                OpenDMX.start();                                            //find and connect to device (first found if multiple)
                if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)        //update status
                {
                    DMXStatusLabel.Text      = "No DMX Device";
                    DMXStatusLabel.BackColor = Color.DarkOrange;
                }
                else if (OpenDMX.status == FT_STATUS.FT_OK)
                {
                    DMXStatusLabel.Text      = "DMX Connected";
                    DMXStatusLabel.BackColor = Color.Green;
                }
                else
                {
                    DMXStatusLabel.Text      = "DMX Error";
                    DMXStatusLabel.BackColor = Color.DarkOrange;
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
                DMXStatusLabel.Text      = "USB Error";
                DMXStatusLabel.BackColor = Color.Red;
            }

            //for (byte channel = byte.MinValue; channel < byte.MaxValue; channel++ )
            //{
            //    OpenDMX.setDmxValue(channel, 0);
            //}

            foreach (HeadBangerCommandSet command in Enum.GetValues(typeof(HeadBangerCommandSet)))
            {
                byte value;

                //backleft
                value = hb_BackLeft.getValuefromCommand(command);
                OpenDMX.setDmxValue(hb_BackLeft.address + (byte)command, value);
                Console.WriteLine(command.ToString(), value);

                //front left
                value = hb_FrontLeft.getValuefromCommand(command);
                OpenDMX.setDmxValue(hb_FrontLeft.address + (byte)command, value);
                Console.WriteLine(command.ToString(), value);

                //back right
                value = hb_BackRight.getValuefromCommand(command);
                OpenDMX.setDmxValue(hb_BackRight.address + (byte)command, value);
                Console.WriteLine(command.ToString(), value);

                //front right
                value = hb_FrontLeft.getValuefromCommand(command);
                OpenDMX.setDmxValue(hb_FrontLeft.address + (byte)command, value);
                Console.WriteLine(command.ToString(), value);
            }
        }
        private void button7_Click(object sender, EventArgs e)
        {
            int  channel = (byte)int.Parse(this.textBox1.Text);
            byte value   = (byte)int.Parse(this.textBox2.Text);

            Console.WriteLine(string.Format("[CHANNEL:{0}] [VALUE:{1}]", channel, value));

            OpenDMX.SetDmxValue(channel, value);
        }
Exemple #26
0
        public static void StropeShow1_thread()
        {
            while (true)
            {
                OpenDMX.setDmxValue(Strope_Intensity, 255);
                OpenDMX.setDmxValue(Strope_Strope, 250);

                OpenDMX.setDmxValue(Strope_White, 255);
            }
        }
Exemple #27
0
    void SendDMXTestData()
    {
        OpenDMX.setDmxValue(0, 0x00);
        OpenDMX.setDmxValue(1, 0xFF);
        OpenDMX.setDmxValue(2, 0x00);

        OpenDMX.setDmxValue(4, 0x00);
        OpenDMX.setDmxValue(5, 0xAA);
        OpenDMX.setDmxValue(6, 0xFF);
    }
Exemple #28
0
        public static void CosmoKillCommand()
        {
            OpenDMX.setDmxValue(Cosmos1_Turn, 0);
            OpenDMX.setDmxValue(Cosmos1_Control_All_Led, 1);
            OpenDMX.setDmxValue(Cosmos1_Continues_Roll, 0);
            OpenDMX.setDmxValue(Cosmos1_Auto, 0);

            CosmoShow1Started = false;
            CosmoShow4Started = false;
        }
        static void Main(string[] args)
        {
            var settings = new Settings
            {
                AzureServiceBusConnectionString = Environment.GetEnvironmentVariable("DNOLights__AzureServiceBusConnectionString")
            };

            try
            {
                OpenDMX.start(); // Find and connect to device (first found if multiple)

                if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)
                {
                    System.Console.WriteLine("No DMX Device");
                }
                else if (OpenDMX.status == FT_STATUS.FT_OK)
                {
                    System.Console.WriteLine("DMX Connected");
                }
                else
                {
                    System.Console.WriteLine("DMX Error");
                }
            }
            catch (Exception exp)
            {
                System.Console.WriteLine(exp);
                System.Console.WriteLine("USB Error");
            }

            new MessageQueueHelper(settings, Queues.HardwareCommands)
            .SubscribeAsync(msg => {
                var sliderData = JsonConvert.DeserializeObject <SliderData>(msg);

                switch (sliderData.Type)
                {
                case "Pan":
                    Con.WriteLine($"setting pan to {sliderData.Value}");
                    OpenDMX.setDmxValue(1, (byte)sliderData.Value);
                    break;

                case "Tilt":
                    Con.WriteLine($"setting tilt to {sliderData.Value}");
                    OpenDMX.setDmxValue(3, (byte)sliderData.Value);
                    break;

                default:
                    Con.WriteLine($"Unhandled slider type: {sliderData.Type}");
                    break;
                }
            });

            System.Console.WriteLine("Waiting for messages...");
            System.Console.ReadLine();
        }
Exemple #30
0
 public static void Show4() // Green Color
 {
     while (ShowBool4 == true)
     {
         OpenDMX.setDmxValue(187, 15);
         if (ShowBool4 == false)
         {
             break;
         }
     }
 }