public Form1() { InitializeComponent(); session = new RDSSession(); stream = new FileStream(@"D:\RDS_DUMP_KZJK.bin", FileMode.Open); Decode(); }
private void Session_RDSFrameReceivedEvent(Framework.RDSCommand frame, RDSSession session) { //Get type if (frame.GetType() != typeof(BasicDataRDSCommand)) { return; } BasicDataRDSCommand cmd = (BasicDataRDSCommand)frame; //Set data in buffer stationNameBuffer[cmd.stationNameIndex] = cmd.letterA; stationNameBuffer[cmd.stationNameIndex + 1] = cmd.letterB; //Set chunk flag if (cmd.stationNameIndex == 0) { _firstChunkDecoded = true; } //Update final station name, if any if (cmd.stationNameIndex == 6 && _firstChunkDecoded) { stationName = new string(stationNameBuffer); RDSFeatureStationName_StationNameUpdatedEvent?.Invoke(stationName); } //Send event RDSFeatureStationName_StationBufferUpdatedEvent?.Invoke(stationNameBuffer, cmd.stationNameIndex); }
public RDSFeatureStationName(RDSSession session) { stationNameBuffer = new char[8]; _firstChunkDecoded = false; session.RDSFrameReceivedEvent += Session_RDSFrameReceivedEvent; session.RDSSessionResetEvent += Session_RDSSessionResetEvent; }
public RDSFeatureRadioText(RDSSession session) { textBuffer = new char[64]; _firstChunkDecoded = false; _lastClearFlag = null; session.RDSFrameReceivedEvent += Session_RDSFrameReceivedEvent; session.RDSSessionResetEvent += Session_RDSSessionResetEvent; }
private void Session_RDSFrameReceivedEvent(Framework.RDSCommand frame, RDSSession session) { //Get type if (frame.GetType() != typeof(RadioTextRDSCommand)) { return; } RadioTextRDSCommand cmd = (RadioTextRDSCommand)frame; //Set if the clear flag has been changed //http://www.interactive-radio-system.com/docs/EN50067_RDS_Standard.pdf defines that a screen clear should happen if (_lastClearFlag != cmd.clear) { //Clear the buffer for (var i = 0; i < textBuffer.Length; i++) { textBuffer[i] = (char)0x00; } //Set the buffer _lastClearFlag = cmd.clear; _firstChunkDecoded = false; //Send event RDSFeatureRadioText_RadioTextClearedUpdatedEvent?.Invoke(); } else { //Set data in buffer textBuffer[cmd.offset + 0] = cmd.letterA; textBuffer[cmd.offset + 1] = cmd.letterB; textBuffer[cmd.offset + 2] = cmd.letterC; textBuffer[cmd.offset + 3] = cmd.letterD; //Set chunk flag if (cmd.offset == 0) { _firstChunkDecoded = true; } //Update final station name, if any //http://www.interactive-radio-system.com/docs/EN50067_RDS_Standard.pdf defines that the final message must end with \r. We use that to determine when the message is fully written if ((cmd.letterA == '\r' || cmd.letterB == '\r' || cmd.letterC == '\r' || cmd.letterD == '\r') && _firstChunkDecoded) { radioText = new string(textBuffer); RDSFeatureRadioText_RadioTextUpdatedEvent?.Invoke(radioText); } } //Send event RDSFeatureRadioText_RadioTextBufferUpdatedEvent?.Invoke(textBuffer, cmd.offset, 4); }
private void Session_RDSSessionResetEvent(RDSSession session) { radioText = null; _firstChunkDecoded = false; }
private void Session_RDSFrameReceivedEvent(OpenRDS.Framework.RDSCommand frame, RDSSession session) { Console.WriteLine(frame._header.groupType.ToString() + ":" + frame._header.isTypeA.ToString()); }
private void Session_RDSSessionResetEvent(RDSSession session) { stationName = null; _firstChunkDecoded = false; }