예제 #1
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();
        }
예제 #2
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();
        }
예제 #3
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();
        }
예제 #4
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();
        }
예제 #5
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(text_char);
            w.End();
        }
예제 #6
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(componentList);
            w.End();
        }
예제 #7
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();

            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)
                    {
                        uint cmdParam  = BitConverter.ToUInt32(bHead, 0);
                        byte[] cmdData = new byte[BitConverter.ToUInt32(bHead, 4)];
                        if (ReadAll(stream, cmdData, 0, cmdData.Length) == cmdData.Length && cmdParam == (uint)ErrCode.CMD_SUCCESS)
                        {
                            //通常の通知コマンドに変換
                            targetCount = cmdProc.Invoke((uint)CtrlCmd.CMD_TIMER_GUI_SRV_STATUS_NOTIFY2, cmdData).Item3;
                        }
                    }
                }
                //pollingClientが置きかわっていなければ引き続き待ち受ける
                var nextClient = new TcpClient(srvIP.AddressFamily);
                if (Interlocked.CompareExchange(ref pollingClient, nextClient, client) == client)
                {
                    StartPolling(nextClient, srvIP, srvPort, targetCount);
                }
            }, null);
        }
예제 #8
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(serviceInfo);
            w.Write(eventList);
            w.End();
        }
예제 #9
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(ctrlID);
            w.Write(filePath);
            w.End();
        }
예제 #10
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(bonDriver);
            w.Write(chInfo);
            w.End();
        }
예제 #11
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();
        }
예제 #12
0
        private ErrCode SendCmdData(CtrlCmd param, object val)
        {
            var w = new CtrlCmdWriter(new MemoryStream());

            w.Write(val);
            MemoryStream res = null;

            return(SendCmdStream(param, w.Stream, ref res));
        }
예제 #13
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();
        }
예제 #14
0
        public void Write(MemoryStream s, ushort version)
        {
            var w = new CtrlCmdWriter(s, version);

            w.Begin();
            w.Write(keyList);
            w.Write(enumStart);
            w.Write(enumEnd);
            w.End();
        }
예제 #15
0
        /// <summary>指定ファイルを転送する</summary>
        public ErrCode SendFileCopy(string val, out byte[] resVal)
        {
            var w = new CtrlCmdWriter(new MemoryStream());

            w.Write(val);
            MemoryStream res = null;
            ErrCode      ret = SendCmdStream(CtrlCmd.CMD_EPG_SRV_FILE_COPY, w.Stream, ref res);

            resVal = ret == ErrCode.CMD_SUCCESS ? res.ToArray() : null;
            return(ret);
        }
예제 #16
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();
        }
예제 #17
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();
        }
예제 #18
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();
        }
예제 #19
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();
        }
예제 #20
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();
        }
예제 #21
0
        private ErrCode SendAndReceiveCmdData(CtrlCmd param, object val, ref object resVal)
        {
            var w = new CtrlCmdWriter(new MemoryStream());

            w.Write(val);
            MemoryStream res = null;
            ErrCode      ret = SendCmdStream(param, w.Stream, ref res);

            if (ret == ErrCode.CMD_SUCCESS)
            {
                (new CtrlCmdReader(res)).Read(ref resVal);
            }
            return(ret);
        }
예제 #22
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();
        }
예제 #23
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();
        }
예제 #24
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();
        }
예제 #25
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();
        }
예제 #26
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();
        }
예제 #27
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();
        }
예제 #28
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();
        }
예제 #29
0
        private ErrCode ReceiveCmdData2(CtrlCmd param, ref object val)
        {
            var w = new CtrlCmdWriter(new MemoryStream(), CMD_VER);

            w.Write(CMD_VER);
            MemoryStream res = null;
            ErrCode      ret = SendCmdStream(param, w.Stream, ref res);

            if (ret == ErrCode.CMD_SUCCESS)
            {
                var    r       = new CtrlCmdReader(res);
                ushort version = 0;
                r.Read(ref version);
                r.Version = version;
                r.Read(ref val);
            }
            return(ret);
        }
예제 #30
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((byte)0);
            w.Write(new DateTime());
            w.Write((byte)0);
            w.Write((uint)0);
            for (int i = 0; i < 7; i++)
            {
                w.Write(4);
            }
            w.Write((byte)0);
            w.End();
        }