コード例 #1
0
ファイル: comms.cs プロジェクト: dannydulai/voo
 public void SendComms(CommsSource dest, byte cmd)
 {
     byte[] buf = new byte[4];
     buf[0] = 1;         // length of command and data bytes
     buf[1] = (byte)((int)_category << 3 | _productaddr);
     buf[2] = (byte)((int)dest << 3 | _systemaddr);
     buf[3] = cmd;
     _SendComms(buf);
 }
コード例 #2
0
ファイル: comms.cs プロジェクト: dannydulai/voo
        void _iface_Received(CommsSource src, int sourceaddr, CommsSource dest, int destaddr, byte cmd, byte data1, byte data2)
        {
            if (dest != CommsSource.SystemWide && dest != _iface.Category)
            {
                return;         // ignore comms messages destined for other types of devices
            }
            if (destaddr != _iface.SystemAddr)
            {
                return;         // ignore comms messages destined for other meridian systems
            }
            if (dest == CommsSource.SystemWide)
            {
                if ((cmd >= 1 && cmd <= 11) || cmd == 17)
                {
                    _systemsourcenum = cmd;
                    if (SourceSelectionReceived != null)
                    {
                        SourceSelectionReceived(cmd);
                    }
                }
                else if (cmd == 16)
                {
                    if (OffReceived != null)
                    {
                        OffReceived();
                    }
                    _systemsourcenum = 16;
                }
                else if (cmd == 20)
                {
                    if (data1 >= 1 && data1 <= 99)
                    {
                        _systemvolume = data1;
                        if (VolumeReceived != null)
                        {
                            VolumeReceived(_systemvolume);
                        }
                    }
                }
            }
            else if (dest == _iface.Category)
            {
                if (destaddr == _iface.ProductAddr)
                {
                    switch (cmd)
                    {
                    case 10: _Key(Key.Next); break;

                    case 11: _Key(Key.Previous); break;

                    case 12: _Key(Key.Play); break;

                    case 13: _Key(Key.Stop); break;

                    case 14: _Key(Key.Pause); break;

                    case 18: _Key(Key.FastForward); break;

                    case 19: _Key(Key.Rewind); break;
                    }
                }
            }
        }
コード例 #3
0
ファイル: comms.cs プロジェクト: dannydulai/voo
        void _iface_Received(CommsSource src, int sourceaddr, CommsSource dest, int destaddr, byte cmd, byte data1, byte data2)
        {
            if (dest != CommsSource.SystemWide && dest != _iface.Category)
                return;         // ignore comms messages destined for other types of devices
            if (destaddr != _iface.SystemAddr)
                return;         // ignore comms messages destined for other meridian systems

            if (dest == CommsSource.SystemWide)
            {
                if ((cmd >= 1 && cmd <= 11) || cmd == 17)
                {
                    _systemsourcenum = cmd;
                    if (SourceSelectionReceived != null)
                        SourceSelectionReceived(cmd);
                }
                else if (cmd == 16)
                {
                    if (OffReceived != null)
                        OffReceived();
                    _systemsourcenum = 16;
                }
                else if (cmd == 20)
                {
                    if (data1 >= 1 && data1 <= 99) {
                        _systemvolume = data1;
                        if (VolumeReceived != null)
                            VolumeReceived(_systemvolume);
                    }
                }
            }
            else if (dest == _iface.Category)
            {
                if (destaddr == _iface.ProductAddr)
                {
                    switch (cmd)
                    {
                        case 10: _Key(Key.Next); break;
                        case 11: _Key(Key.Previous); break;
                        case 12: _Key(Key.Play); break;
                        case 13: _Key(Key.Stop); break;
                        case 14: _Key(Key.Pause); break;
                        case 18: _Key(Key.FastForward); break;
                        case 19: _Key(Key.Rewind); break;
                    }
                }
            }
        }
コード例 #4
0
ファイル: comms.cs プロジェクト: dannydulai/voo
 public void SendComms(CommsSource dest, byte cmd, byte data1, byte data2)
 {
     byte[] buf = new byte[6];
     buf[0] = 3;         // length of command and data bytes
     buf[1] = (byte)((int)_category << 3 | _productaddr);
     buf[2] = (byte)((int)dest << 3 | _systemaddr);
     buf[3] = cmd;
     buf[4] = data1;
     buf[5] = data2;
     _SendComms(buf);
 }