Esempio n. 1
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(componentList);
     w.End();
 }
Esempio n. 2
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(RecFolder);
     w.Write(WritePlugIn);
     w.Write(RecNamePlugIn);
     w.Write(RecFileName);
     w.End();
 }
Esempio n. 3
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(dataID);
     w.Write(andKey_);
     w.End();
 }
Esempio n. 4
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(startDayOfWeek);
     w.Write(startHour);
     w.Write(startMin);
     w.Write(endDayOfWeek);
     w.Write(endHour);
     w.Write(endMin);
     w.End();
 }
Esempio n. 5
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(ONID);
     w.Write(TSID);
     w.Write(SID);
     w.Write(service_type);
     w.Write(partialReceptionFlag);
     w.Write(service_provider_name);
     w.Write(service_name);
     w.Write(network_name);
     w.Write(ts_name);
     w.Write(remote_control_key_id);
     w.End();
 }
Esempio n. 6
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(group_type);
     w.Write(eventDataList);
     w.End();
 }
Esempio n. 7
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(stream_content);
     w.Write(component_type);
     w.Write(component_tag);
     w.Write(stream_type);
     w.Write(simulcast_group_tag);
     w.Write(ES_multi_lingual_flag);
     w.Write(main_component_flag);
     w.Write(quality_indicator);
     w.Write(sampling_rate);
     w.Write(text_char);
     w.End();
 }
Esempio n. 8
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(content_nibble_level_1);
     w.Write(content_nibble_level_2);
     w.Write(user_nibble_1);
     w.Write(user_nibble_2);
     w.End();
 }
Esempio n. 9
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(dataID);
     w.Write(dayOfWeekFlag);
     w.Write(startTime);
     w.Write(durationSecond);
     w.Write(title);
     w.Write(stationName);
     w.Write(originalNetworkID);
     w.Write(transportStreamID);
     w.Write(serviceID);
     w.Write(recSetting);
     w.End();
 }
Esempio n. 10
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(dataID);
     w.Write(searchInfo);
     w.Write(recSetting);
     if (version >= 5)
     {
         w.Write(addCount);
     }
     w.End();
 }
Esempio n. 11
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(andKey);
     w.Write(notKey);
     w.Write(regExpFlag);
     w.Write(titleOnlyFlag);
     w.Write(contentList);
     w.Write(dateList);
     w.Write(serviceList);
     w.Write(videoList);
     w.Write(audioList);
     w.Write(aimaiFlag);
     w.Write(notContetFlag);
     w.Write(notDateFlag);
     w.Write(freeCAFlag);
     if (version >= 3)
     {
         w.Write(chkRecEnd);
         w.Write(chkRecDay);
     }
     w.End();
 }
Esempio n. 12
0
        private void StartPolling(TcpClient client, IPAddress srvIP, uint srvPort, uint targetCount)
        {
            //巡回カウンタがtargetCountよりも大きくなる新しい通知を待ち受ける
            var w = new CtrlCmdWriter(new MemoryStream());
            w.Write((ushort)0);
            w.Write(targetCount);
            byte[] bHead = new byte[8 + w.Stream.Length];
            BitConverter.GetBytes((uint)CtrlCmd.CMD_EPG_SRV_GET_STATUS_NOTIFY2).CopyTo(bHead, 0);
            BitConverter.GetBytes((uint)w.Stream.Length).CopyTo(bHead, 4);
            w.Stream.Close();
            w.Stream.ToArray().CopyTo(bHead, 8);

            try
            {
                client.Connect(srvIP, (int)srvPort);
            }
            catch (SocketException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex);
                Interlocked.CompareExchange(ref pollingClient, null, client);
                return;
            }
            NetworkStream stream = client.GetStream();

            if (CommonManager.Instance.CtrlCmd.Authenticate(stream, ref bHead) != ErrCode.CMD_SUCCESS)
            {
                // 認証エラー
                Interlocked.CompareExchange(ref pollingClient, null, client);
                return;
            }

            // 送信: 認証応答パケットとコマンドパケットをまとめて送る
            stream.Write(bHead, 0, bHead.Length);

            stream.BeginRead(bHead, 0, 8, (IAsyncResult ar) =>
            {
                using (client)
                {
                    int readSize = 0;
                    try
                    {
                        readSize = stream.EndRead(ar);
                    }
                    catch (IOException ex)
                    {
                        System.Diagnostics.Trace.WriteLine(ex);
                    }
                    if (readSize > 0 && ReadAll(stream, bHead, readSize, 8 - readSize) == 8 - readSize)
                    {
                        CMD_STREAM stCmd = new CMD_STREAM();
                        stCmd.uiParam = BitConverter.ToUInt32(bHead, 0);
                        stCmd.uiSize = BitConverter.ToUInt32(bHead, 4);
                        stCmd.bData = new byte[stCmd.uiSize];
                        if (ReadAll(stream, stCmd.bData, 0, stCmd.bData.Length) == stCmd.bData.Length && stCmd.uiParam == (uint)ErrCode.CMD_SUCCESS)
                        {
                            //通常の通知コマンドに変換
                            stCmd.uiParam = (uint)CtrlCmd.CMD_TIMER_GUI_SRV_STATUS_NOTIFY2;
                            cmdProc.Invoke(stCmd, new CMD_STREAM());
                            targetCount = stCmd.uiSize;
                        }
                    }
                }
                //pollingClientが置きかわっていなければ引き続き待ち受ける
                var nextClient = new TcpClient();
                if (Interlocked.CompareExchange(ref pollingClient, nextClient, client) == client)
                {
                    StartPolling(nextClient, srvIP, srvPort, targetCount);
                }
            }, null);
        }
Esempio n. 13
0
        public void Write(MemoryStream s, ushort version)
        {
            //andKey装飾のフラグをここで処理
            string andKey_Send = (caseFlag == 1 ? "C!{999}" : "") + andKey;
            andKey_Send = (keyDisabledFlag == 1 ? "^!{999}" : "") + andKey_Send;

            var w = new CtrlCmdWriter(s, version);
            w.Write(andKey_Send);
        }
Esempio n. 14
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(Title);
     w.Write(StartTime);
     w.Write(DurationSecond);
     w.Write(OriginalNetworkID);
     w.Write(TransportStreamID);
     w.Write(ServiceID);
     w.Write(EventID);
     w.Write(ReserveID);
     w.End();
 }
Esempio n. 15
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(ID);
     w.Write(RecFilePath);
     w.Write(Title);
     w.Write(StartTime);
     w.Write(DurationSecond);
     w.Write(ServiceName);
     w.Write(OriginalNetworkID);
     w.Write(TransportStreamID);
     w.Write(ServiceID);
     w.Write(EventID);
     w.Write(Drops);
     w.Write(Scrambles);
     w.Write(RecStatus);
     w.Write(StartTimeEpg);
     w.Write(Comment);
     w.Write(ProgramInfo);
     w.Write(ErrInfo);
     if (version >= 4)
     {
         w.Write(ProtectFlag);
     }
     w.End();
 }
Esempio n. 16
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(RecMode);
     w.Write(Priority);
     w.Write(TuijyuuFlag);
     w.Write(ServiceMode);
     w.Write(PittariFlag);
     w.Write(BatFilePath);
     w.Write(RecFolderList);
     w.Write(SuspendMode);
     w.Write(RebootFlag);
     w.Write(UseMargineFlag);
     w.Write(StartMargine);
     w.Write(EndMargine);
     w.Write(ContinueRecFlag);
     w.Write(PartialRecFlag);
     w.Write(TunerID);
     if (version >= 2)
     {
         w.Write(PartialRecFolder);
     }
     w.End();
 }
Esempio n. 17
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(tunerID);
     w.Write(tunerName);
     w.Write(reserveList);
     w.End();
 }
Esempio n. 18
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(useSID);
     w.Write(ONID);
     w.Write(TSID);
     w.Write(SID);
     w.Write(useBonCh);
     w.Write(space);
     w.Write(ch);
     w.End();
 }
Esempio n. 19
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(text_char);
     w.End();
 }
Esempio n. 20
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(bonDriver);
     w.Write(chInfo);
     w.End();
 }
Esempio n. 21
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(stream_content);
     w.Write(component_type);
     w.Write(component_tag);
     w.Write(text_char);
     w.End();
 }
Esempio n. 22
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(enableMode);
     w.Write(ctrlID);
     w.Write(serverIP);
     w.Write(serverPort);
     w.Write(filePath);
     w.Write(udpSend);
     w.Write(tcpSend);
     w.Write(timeShiftMode);
     w.End();
 }
Esempio n. 23
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(original_network_id);
     w.Write(transport_stream_id);
     w.Write(service_id);
     w.Write(event_id);
     w.End();
 }
Esempio n. 24
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(ctrlID);
     w.Write(filePath);
     w.End();
 }
Esempio n. 25
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(original_network_id);
     w.Write(transport_stream_id);
     w.Write(service_id);
     w.Write(event_id);
     w.Write(StartTimeFlag);
     w.Write(start_time);
     w.Write(DurationFlag);
     w.Write(durationSec);
     if (ShortInfo != null) w.Write(ShortInfo); else w.Write(4);
     if (ExtInfo != null) w.Write(ExtInfo); else w.Write(4);
     if (ContentInfo != null) w.Write(ContentInfo); else w.Write(4);
     if (ComponentInfo != null) w.Write(ComponentInfo); else w.Write(4);
     if (AudioInfo != null) w.Write(AudioInfo); else w.Write(4);
     if (EventGroupInfo != null) w.Write(EventGroupInfo); else w.Write(4);
     if (EventRelayInfo != null) w.Write(EventRelayInfo); else w.Write(4);
     w.Write(FreeCAFlag);
     w.End();
 }
Esempio n. 26
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(notifyID);
     w.Write(time);
     w.Write(param1);
     w.Write(param2);
     w.Write(param3);
     w.Write(param4);
     w.Write(param5);
     w.Write(param6);
     w.End();
 }
Esempio n. 27
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(serviceInfo);
     w.Write(eventList);
     w.End();
 }
Esempio n. 28
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(Title);
     w.Write(StartTime);
     w.Write(DurationSecond);
     w.Write(StationName);
     w.Write(OriginalNetworkID);
     w.Write(TransportStreamID);
     w.Write(ServiceID);
     w.Write(EventID);
     w.Write(Comment);
     w.Write(ReserveID);
     w.Write(UnusedRecWaitFlag);
     w.Write(OverlapMode);
     w.Write(UnusedRecFilePath);
     w.Write(StartTimeEpg);
     w.Write(RecSetting);
     w.Write(ReserveStatus);
     if (version >= 5)
     {
         w.Write(RecFileNameList);
         w.Write(UnusedParam1);
     }
     w.End();
 }
Esempio n. 29
0
        private void OutsideCmdCallback(CMD_STREAM pCmdParam, CMD_STREAM pResParam, bool networkFlag)
        {
            System.Diagnostics.Trace.WriteLine((CtrlCmd)pCmdParam.uiParam);

            switch ((CtrlCmd)pCmdParam.uiParam)
            {
                case CtrlCmd.CMD_TIMER_GUI_SHOW_DLG:
                    if (networkFlag)
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_NON_SUPPORT;
                    }
                    else
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_SUCCESS;
                        this.Visibility = System.Windows.Visibility.Visible;
                    }
                    break;
                case CtrlCmd.CMD_TIMER_GUI_VIEW_EXECUTE:
                    if (networkFlag)
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_NON_SUPPORT;
                    }
                    else
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_SUCCESS;
                        String exeCmd = "";
                        (new CtrlCmdReader(new System.IO.MemoryStream(pCmdParam.bData, false))).Read(ref exeCmd);
                        try
                        {
                            string[] cmd = exeCmd.Split('\"');
                            System.Diagnostics.Process process;
                            System.Diagnostics.ProcessStartInfo startInfo;
                            if (cmd.Length >= 3)
                            {
                                startInfo = new System.Diagnostics.ProcessStartInfo(cmd[1], cmd[2]);
                            }
                            else if (cmd.Length >= 2)
                            {
                                startInfo = new System.Diagnostics.ProcessStartInfo(cmd[1]);
                            }
                            else
                            {
                                startInfo = new System.Diagnostics.ProcessStartInfo(cmd[0]);
                            }
                            if (cmd.Length >= 2)
                            {
                                if (cmd[1].IndexOf(".bat") >= 0)
                                {
                                    startInfo.CreateNoWindow = true;
                                    if (Settings.Instance.ExecBat == 0)
                                    {
                                        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
                                    }
                                    else if (Settings.Instance.ExecBat == 1)
                                    {
                                        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                                    }
                                }
                            }
                            process = System.Diagnostics.Process.Start(startInfo);
                            var w = new CtrlCmdWriter(new System.IO.MemoryStream());
                            w.Write(process.Id);
                            w.Stream.Close();
                            pResParam.bData = w.Stream.ToArray();
                            pResParam.uiSize = (uint)pResParam.bData.Length;
                        }
                        catch { }
                    }
                    break;
                case CtrlCmd.CMD_TIMER_GUI_QUERY_SUSPEND:
                    if (networkFlag)
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_NON_SUPPORT;
                    }
                    else
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_SUCCESS;

                        UInt16 param = 0;
                        (new CtrlCmdReader(new System.IO.MemoryStream(pCmdParam.bData, false))).Read(ref param);

                        Dispatcher.BeginInvoke(new Action(() => { if (closeFlag == false) ShowSleepDialog(param); }));
                    }
                    break;
                case CtrlCmd.CMD_TIMER_GUI_QUERY_REBOOT:
                    if (networkFlag)
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_NON_SUPPORT;
                    }
                    else
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_SUCCESS;

                        UInt16 param = 0;
                        (new CtrlCmdReader(new System.IO.MemoryStream(pCmdParam.bData, false))).Read(ref param);

                        Byte reboot = (Byte)((param & 0xFF00) >> 8);
                        Byte suspendMode = (Byte)(param & 0x00FF);

                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            if (closeFlag == true) return;
                            SuspendCheckWindow dlg = new SuspendCheckWindow();
                            dlg.SetMode(reboot, suspendMode);
                            if (dlg.ShowDialog() != true)
                            {
                                SaveData();
                                cmd.SendReboot();
                            }
                        }));
                    }
                    break;
                case CtrlCmd.CMD_TIMER_GUI_SRV_STATUS_NOTIFY2:
                    {
                        pResParam.uiParam = (uint)ErrCode.CMD_SUCCESS;

                        NotifySrvInfo status = new NotifySrvInfo();
                        var r = new CtrlCmdReader(new System.IO.MemoryStream(pCmdParam.bData, false));
                        ushort version = 0;
                        r.Read(ref version);
                        r.Version = version;
                        r.Read(ref status);
                        //通知の巡回カウンタをuiSizeを利用して返す(やや汚い)
                        pCmdParam.uiSize = status.param3;
                        Dispatcher.BeginInvoke(new Action(() => { if (closeFlag == false) NotifyStatus(status); }));
                    }
                    break;
                default:
                    pResParam.uiParam = (uint)ErrCode.CMD_NON_SUPPORT;
                    break;
            }
        }
Esempio n. 30
0
 public void Write(MemoryStream s, ushort version)
 {
     var w = new CtrlCmdWriter(s, version);
     w.Begin();
     w.Write(ID);
     w.Write(RecFilePath);
     w.Write(Title);
     w.Write(StartTime);
     w.Write(DurationSecond);
     w.End();
 }