public static char BaudotCharToAscii(byte baudotCode, KeyStates keyStates, SendRecv sendRecv) { if (baudotCode > 0x1F) { return(ASC_INVALID); } CodeItem codeItem = GetCodeItem(keyStates.CodeSet, baudotCode); return(codeItem.GetChar(keyStates.ShiftState)); }
public static string BaudotStringToAscii(byte[] baudotData, KeyStates keyStates, SendRecv sendRecv, bool debug) { string asciiStr = ""; for (int i = 0; i < baudotData.Length; i++) { byte baudotChr = baudotData[i]; if (baudotChr == BAU_LTRS) { keyStates.ShiftState = ShiftStates.Ltr; if (debug) { asciiStr += ASC_LTRS; } } else if (baudotChr == BAU_FIGS) { keyStates.ShiftState = ShiftStates.Figs; if (debug) { asciiStr += ASC_FIGS; } } else if (baudotChr == BAU_NUL) { bool hasThirdLevel = GetCodeTab(keyStates.CodeSet).HasThirdLevel; if (hasThirdLevel) { keyStates.ShiftState = ShiftStates.Third; } if (debug) { asciiStr += ASC_NUL; } } else { char asciiChr = BaudotCharToAscii(baudotData[i], keyStates, sendRecv); asciiStr += asciiChr; } } return(asciiStr); }
public static char BaudotCharToAscii(byte baudotCode, ShiftStates shiftState, CodeSets codeSet, SendRecv sendRecv) { if (baudotCode > 0x1F) { return((char)ASC_INV); } char asciiChr = _codeTab[baudotCode].GetCode(shiftState, codeSet); /* * if (asciiChr == ASC_INV && sendRecv==SendRecv.Recv) * { * // received an invalid code: try extended code page * asciiChr = _codeTab[baudotCode].GetCode(shiftState, CodeSets.ITA2EXT); * } */ return(asciiChr); }
public static string BaudotStringToAscii(byte[] baudotData, ref ShiftStates shiftState, CodeSets codeSet, SendRecv sendRecv) { string asciiStr = ""; for (int i = 0; i < baudotData.Length; i++) { byte baudotChr = baudotData[i]; if (baudotChr == BAU_LTRS) { shiftState = ShiftStates.Ltr; } else if (baudotChr == BAU_FIGS) { shiftState = ShiftStates.Figs; } else { char asciiChr = BaudotCharToAscii(baudotData[i], shiftState, codeSet, sendRecv); asciiStr += asciiChr; } } return(asciiStr); }