Example #1
0
 /// <summary>チャンネル切り替え</summary>
 public ErrCode SendViewSetCh(SetChInfo chInfo)
 {
     return(SendCmdData(CtrlCmd.CMD_VIEW_APP_SET_CH, chInfo));
 }
Example #2
0
        public bool SetLiveCh(UInt16 ONID, UInt16 TSID, UInt16 SID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return(false);
                }
                OpenTVTest(Settings.Instance.TvTestOpenWait, Settings.Instance.NwTvMode == false);
                var cmdTvTest = new CtrlCmdUtil();
                cmdTvTest.SetPipeSetting("Global\\" + processType + "_Ctrl_BonConnect_" + process.Id, processType + "_Ctrl_BonPipe_" + process.Id);
                cmdTvTest.SetConnectTimeOut(1000);

                if (Settings.Instance.NwTvMode == true)
                {
                    SetChInfo chInfo = new SetChInfo();
                    chInfo.useSID   = 1;
                    chInfo.useBonCh = 0;
                    chInfo.ONID     = ONID;
                    chInfo.TSID     = TSID;
                    chInfo.SID      = SID;

                    UInt32 nwMode      = 0;
                    String nwBonDriver = "BonDriver_UDP.dll";
                    if (Settings.Instance.NwTvModeUDP == true)
                    {
                        nwMode += 1;
                    }
                    if (Settings.Instance.NwTvModeTCP == true)
                    {
                        nwMode     += 2;
                        nwBonDriver = "BonDriver_TCP.dll";
                    }

                    if (CommonManager.CreateSrvCtrl().SendNwTVMode(nwMode) == ErrCode.CMD_SUCCESS)
                    {
                        if (CommonManager.CreateSrvCtrl().SendNwTVSetCh(chInfo) == ErrCode.CMD_SUCCESS)
                        {
                            String val = "";
                            for (int i = 0; i < 10; i++)
                            {
                                if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    continue;
                                }
                                if (val.Equals(nwBonDriver, StringComparison.OrdinalIgnoreCase) == false)
                                {
                                    cmdTvTest.SendViewSetBonDrivere(nwBonDriver);
                                }
                                break;
                            }
                        }
                    }
                }
                else
                {
                    UInt64 key = ((UInt64)ONID) << 32 |
                                 ((UInt64)TSID) << 16 |
                                 ((UInt64)SID);
                    TvTestChChgInfo chInfo = new TvTestChChgInfo();
                    ErrCode         err    = CommonManager.CreateSrvCtrl().SendGetChgChTVTest(key, ref chInfo);
                    if (err == ErrCode.CMD_SUCCESS)
                    {
                        String val = "";
                        for (int i = 0; i < 10; i++)
                        {
                            if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                            {
                                System.Threading.Thread.Sleep(1000);
                                continue;
                            }
                            // 識別用IDが設定されたViewアプリは弄らない
                            if (processType == "View")
                            {
                                int id = -1;
                                if (cmdTvTest.SendViewGetID(ref id) != ErrCode.CMD_SUCCESS || id >= 0)
                                {
                                    break;
                                }
                            }
                            if (val.Equals(chInfo.bonDriver, StringComparison.OrdinalIgnoreCase) == false)
                            {
                                if (cmdTvTest.SendViewSetBonDrivere(chInfo.bonDriver) == ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(Settings.Instance.TvTestChgBonWait);
                                    cmdTvTest.SendViewSetCh(chInfo.chInfo);
                                }
                            }
                            else
                            {
                                cmdTvTest.SendViewSetCh(chInfo.chInfo);
                            }
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "指定サービスを受信できるBonDriverが設定されていません。");
                        return(false);
                    }
                }

                WakeupWindow(process.MainWindowHandle);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return(true);
        }
Example #3
0
 /// <summary>ネットワークモードのEpgDataCap_Bonのチャンネルを切り替え</summary>
 public ErrCode SendNwTVSetCh(SetChInfo val)
 {
     return(SendCmdData(CtrlCmd.CMD_EPG_SRV_NWTV_SET_CH, val));
 }
Example #4
0
 /// <summary>NetworkTVモードのViewアプリのチャンネルを切り替え、または起動の確認(ID指定)</summary>
 public ErrCode SendNwTVIDSetCh(SetChInfo val, ref int processID)
 {
     object o = processID; var ret = SendAndReceiveCmdData(CtrlCmd.CMD_EPG_SRV_NWTV_ID_SET_CH, val, ref o); processID = (int)o; return(ret);
 }
Example #5
0
        public bool SetLiveCh(UInt16 ONID, UInt16 TSID, UInt16 SID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return(false);
                }
                if (IsOpenTVTest() == false)
                {
                    processID = FindTVTestProcess();
                    if (processID == -1)
                    {
                        Process process;
                        process   = System.Diagnostics.Process.Start(Settings.Instance.TvTestExe, Settings.Instance.TvTestCmd);
                        processID = process.Id;
                        System.Threading.Thread.Sleep(Settings.Instance.TvTestOpenWait);
                    }
                }
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + processID.ToString(), "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + processID.ToString());
                cmdTvTest.SetConnectTimeOut(1000);

                if (Settings.Instance.NwTvMode == true)
                {
                    SetChInfo chInfo = new SetChInfo();
                    chInfo.useSID   = 1;
                    chInfo.useBonCh = 0;
                    chInfo.ONID     = ONID;
                    chInfo.TSID     = TSID;
                    chInfo.SID      = SID;

                    UInt32 nwMode      = 0;
                    String nwBonDriver = "BonDriver_UDP.dll";
                    if (Settings.Instance.NwTvModeUDP == true)
                    {
                        nwMode += 1;
                    }
                    if (Settings.Instance.NwTvModeTCP == true)
                    {
                        nwMode     += 2;
                        nwBonDriver = "BonDriver_TCP.dll";
                    }

                    if (cmd.SendNwTVMode(nwMode) == 1)
                    {
                        if (cmd.SendNwTVSetCh(chInfo) == 1)
                        {
                            String val = "";
                            if (cmdTvTest.SendViewGetBonDrivere(ref val) == 1)
                            {
                                if (String.Compare(val, nwBonDriver, true) != 0)
                                {
                                    cmdTvTest.SendViewSetBonDrivere(nwBonDriver);
                                }
                            }
                        }
                    }
                }
                else
                {
                    UInt64 key = ((UInt64)ONID) << 32 |
                                 ((UInt64)TSID) << 16 |
                                 ((UInt64)SID);
                    TvTestChChgInfo chInfo = new TvTestChChgInfo();
                    UInt32          err    = cmd.SendGetChgChTVTest(key, ref chInfo);
                    if (err == 1)
                    {
                        String val = "";
                        if (cmdTvTest.SendViewGetBonDrivere(ref val) == 1)
                        {
                            if (String.Compare(val, chInfo.bonDriver, true) != 0)
                            {
                                if (cmdTvTest.SendViewSetBonDrivere(chInfo.bonDriver) == 1)
                                {
                                    System.Threading.Thread.Sleep(Settings.Instance.TvTestChgBonWait);
                                    cmdTvTest.SendViewSetCh(chInfo.chInfo);
                                }
                            }
                            else
                            {
                                cmdTvTest.SendViewSetCh(chInfo.chInfo);
                            }
                        }
                    }
                    else if (err == 205)
                    {
                        MessageBox.Show("サーバーに接続できませんでした");
                        return(false);
                    }
                    else
                    {
                        MessageBox.Show("指定サービスを受信できるBonDriverが設定されていません。");
                        return(false);
                    }
                }

                WakeupWindow(processID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return(true);
        }
Example #6
0
        public bool SetLiveCh(UInt16 ONID, UInt16 TSID, UInt16 SID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return false;
                }
                if (IsOpenTVTest() == false)
                {
                    processID = FindTVTestProcess();
                    if (processID == -1)
                    {
                        Process process;
                        process = System.Diagnostics.Process.Start(Settings.Instance.TvTestExe, Settings.Instance.TvTestCmd);
                        processID = process.Id;
                        System.Threading.Thread.Sleep(Settings.Instance.TvTestOpenWait);
                    }
                }
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + processID.ToString(), "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + processID.ToString());
                cmdTvTest.SetConnectTimeOut(1000);

                if (Settings.Instance.NwTvMode == true)
                {
                    SetChInfo chInfo = new SetChInfo();
                    chInfo.useSID = 1;
                    chInfo.useBonCh = 0;
                    chInfo.ONID = ONID;
                    chInfo.TSID = TSID;
                    chInfo.SID = SID;

                    UInt32 nwMode = 0;
                    String nwBonDriver = "BonDriver_UDP.dll";
                    if (Settings.Instance.NwTvModeUDP == true)
                    {
                        nwMode += 1;
                    }
                    if (Settings.Instance.NwTvModeTCP == true)
                    {
                        nwMode += 2;
                        nwBonDriver = "BonDriver_TCP.dll";
                    }

                    if (cmd.SendNwTVMode(nwMode) == 1)
                    {
                        if (cmd.SendNwTVSetCh(chInfo) == 1)
                        {
                            String val = "";
                            if (cmdTvTest.SendViewGetBonDrivere(ref val) == 1)
                            {
                                if (String.Compare(val, nwBonDriver, true) != 0)
                                {
                                    cmdTvTest.SendViewSetBonDrivere(nwBonDriver);
                                }
                            }
                        }
                    }
                }
                else
                {
                    UInt64 key = ((UInt64)ONID) << 32 |
                        ((UInt64)TSID) << 16 |
                        ((UInt64)SID);
                    TvTestChChgInfo chInfo = new TvTestChChgInfo();
                    UInt32 err = cmd.SendGetChgChTVTest(key, ref chInfo);
                    if (err == 1)
                    {
                        String val = "";
                        if (cmdTvTest.SendViewGetBonDrivere(ref val) == 1)
                        {
                            if (String.Compare(val, chInfo.bonDriver, true) != 0)
                            {
                                if (cmdTvTest.SendViewSetBonDrivere(chInfo.bonDriver) == 1)
                                {
                                    System.Threading.Thread.Sleep(Settings.Instance.TvTestChgBonWait);
                                    cmdTvTest.SendViewSetCh(chInfo.chInfo);
                                }
                            }
                            else
                            {
                                cmdTvTest.SendViewSetCh(chInfo.chInfo);
                            }
                        }
                    }
                    else if (err == 205)
                    {
                        MessageBox.Show("サーバーに接続できませんでした");
                        return false;
                    }
                    else
                    {
                        MessageBox.Show("指定サービスを受信できるBonDriverが設定されていません。");
                        return false;
                    }
                }

                WakeupWindow(processID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return true;
        }
Example #7
0
 public TvTestChChgInfo()
 {
     bonDriver = "";
     chInfo    = new SetChInfo();
 }
Example #8
0
 public TvTestChChgInfo()
 {
     bonDriver = "";
     chInfo = new SetChInfo();
 }
Example #9
0
        public bool SetLiveCh(UInt16 ONID, UInt16 TSID, UInt16 SID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return(false);
                }
                // TVTestのパスが録画用アプリと一致する場合はViewアプリとして扱う
                bool isView = CommonManager.Instance.NWMode == false &&
                              Settings.Instance.NwTvMode == false &&
                              string.Compare(IniFileHandler.GetPrivateProfileString("SET", "RecExePath", "", SettingPath.CommonIniPath), Settings.Instance.TvTestExe, true) == 0;
                OpenTVTest(Settings.Instance.TvTestOpenWait, isView ? "View" : "TvTest");
                var cmdTvTest = new CtrlCmdUtil();
                cmdTvTest.SetPipeSetting("Global\\" + processType + "_Ctrl_BonConnect_" + process.Id, "\\\\.\\pipe\\" + processType + "_Ctrl_BonPipe_" + process.Id);
                cmdTvTest.SetConnectTimeOut(1000);

                if (Settings.Instance.NwTvMode == true)
                {
                    SetChInfo chInfo = new SetChInfo();
                    chInfo.useSID   = 1;
                    chInfo.useBonCh = 0;
                    chInfo.ONID     = ONID;
                    chInfo.TSID     = TSID;
                    chInfo.SID      = SID;

                    UInt32 nwMode      = 0;
                    String nwBonDriver = "BonDriver_UDP.dll";
                    if (Settings.Instance.NwTvModeUDP == true)
                    {
                        nwMode += 1;
                    }
                    if (Settings.Instance.NwTvModeTCP == true)
                    {
                        nwMode     += 2;
                        nwBonDriver = "BonDriver_TCP.dll";
                    }

                    if (cmd.SendNwTVMode(nwMode) == ErrCode.CMD_SUCCESS)
                    {
                        if (cmd.SendNwTVSetCh(chInfo) == ErrCode.CMD_SUCCESS)
                        {
                            String val = "";
                            for (int i = 0; i < 10; i++)
                            {
                                if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    continue;
                                }
                                if (String.Compare(val, nwBonDriver, true) != 0)
                                {
                                    cmdTvTest.SendViewSetBonDrivere(nwBonDriver);
                                }
                                break;
                            }
                        }
                    }
                }
                else
                {
                    UInt64          key    = CommonManager.Create64Key(ONID, TSID, SID);
                    TvTestChChgInfo chInfo = new TvTestChChgInfo();
                    ErrCode         err    = cmd.SendGetChgChTVTest(key, ref chInfo);
                    if (err == ErrCode.CMD_SUCCESS)
                    {
                        String val = "";
                        for (int i = 0; i < 10; i++)
                        {
                            if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                            {
                                System.Threading.Thread.Sleep(1000);
                                continue;
                            }
                            // 識別用IDが設定されたViewアプリは弄らない
                            if (processType == "View")
                            {
                                int id = -1;
                                if (cmdTvTest.SendViewGetID(ref id) != ErrCode.CMD_SUCCESS || id >= 0)
                                {
                                    break;
                                }
                            }
                            if (String.Compare(val, chInfo.bonDriver, true) != 0)
                            {
                                if (cmdTvTest.SendViewSetBonDrivere(chInfo.bonDriver) == ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(Settings.Instance.TvTestChgBonWait);
                                    cmdTvTest.SendViewSetCh(chInfo.chInfo);
                                }
                            }
                            else
                            {
                                cmdTvTest.SendViewSetCh(chInfo.chInfo);
                            }
                            break;
                        }
                    }
                    else if (err == ErrCode.CMD_ERR_CONNECT)
                    {
                        MessageBox.Show("サーバーに接続できませんでした");
                        return(false);
                    }
                    else
                    {
                        MessageBox.Show("指定サービスを受信できるBonDriverが設定されていません。");
                        return(false);
                    }
                }

                WakeupWindow(process.MainWindowHandle);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return(true);
        }
Example #10
0
        public bool SetLiveCh(UInt16 ONID, UInt16 TSID, UInt16 SID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return false;
                }
                // TVTestのパスが録画用アプリと一致する場合はViewアプリとして扱う
                bool isView = CommonManager.Instance.NWMode == false &&
                              Settings.Instance.NwTvMode == false &&
                              string.Compare(IniFileHandler.GetPrivateProfileString("SET", "RecExePath", "", SettingPath.CommonIniPath), Settings.Instance.TvTestExe, true) == 0;
                OpenTVTest(Settings.Instance.TvTestOpenWait, isView ? "View" : "TvTest");
                var cmdTvTest = new CtrlCmdUtil();
                cmdTvTest.SetPipeSetting("Global\\" + processType + "_Ctrl_BonConnect_" + process.Id, "\\\\.\\pipe\\" + processType + "_Ctrl_BonPipe_" + process.Id);
                cmdTvTest.SetConnectTimeOut(1000);

                if (Settings.Instance.NwTvMode == true)
                {
                    SetChInfo chInfo = new SetChInfo();
                    chInfo.useSID = 1;
                    chInfo.useBonCh = 0;
                    chInfo.ONID = ONID;
                    chInfo.TSID = TSID;
                    chInfo.SID = SID;

                    UInt32 nwMode = 0;
                    String nwBonDriver = "BonDriver_UDP.dll";
                    if (Settings.Instance.NwTvModeUDP == true)
                    {
                        nwMode += 1;
                    }
                    if (Settings.Instance.NwTvModeTCP == true)
                    {
                        nwMode += 2;
                        nwBonDriver = "BonDriver_TCP.dll";
                    }

                    if (cmd.SendNwTVMode(nwMode) == ErrCode.CMD_SUCCESS)
                    {
                        if (cmd.SendNwTVSetCh(chInfo) == ErrCode.CMD_SUCCESS)
                        {
                            String val = "";
                            for (int i = 0; i < 10; i++)
                            {
                                if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    continue;
                                }
                                if (String.Compare(val, nwBonDriver, true) != 0)
                                {
                                    cmdTvTest.SendViewSetBonDrivere(nwBonDriver);
                                }
                                break;
                            }
                        }
                    }
                }
                else
                {
                    UInt64 key = CommonManager.Create64Key(ONID, TSID, SID);
                    TvTestChChgInfo chInfo = new TvTestChChgInfo();
                    ErrCode err = cmd.SendGetChgChTVTest(key, ref chInfo);
                    if (err == ErrCode.CMD_SUCCESS)
                    {
                        String val = "";
                        for (int i = 0; i < 10; i++)
                        {
                            if (cmdTvTest.SendViewGetBonDrivere(ref val) != ErrCode.CMD_SUCCESS)
                            {
                                System.Threading.Thread.Sleep(1000);
                                continue;
                            }
                            // 識別用IDが設定されたViewアプリは弄らない
                            if (processType == "View")
                            {
                                int id = -1;
                                if (cmdTvTest.SendViewGetID(ref id) != ErrCode.CMD_SUCCESS || id >= 0)
                                {
                                    break;
                                }
                            }
                            if (String.Compare(val, chInfo.bonDriver, true) != 0)
                            {
                                if (cmdTvTest.SendViewSetBonDrivere(chInfo.bonDriver) == ErrCode.CMD_SUCCESS)
                                {
                                    System.Threading.Thread.Sleep(Settings.Instance.TvTestChgBonWait);
                                    cmdTvTest.SendViewSetCh(chInfo.chInfo);
                                }
                            }
                            else
                            {
                                cmdTvTest.SendViewSetCh(chInfo.chInfo);
                            }
                            break;
                        }
                    }
                    else if (err == ErrCode.CMD_ERR_CONNECT)
                    {
                        MessageBox.Show("サーバーに接続できませんでした");
                        return false;
                    }
                    else
                    {
                        MessageBox.Show("指定サービスを受信できるBonDriverが設定されていません。");
                        return false;
                    }
                }

                WakeupWindow(process.MainWindowHandle);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return true;
        }