using Nonemm.Core; using Nonemm.Session; namespace Nonemm.App; /// The function key messages, held as the text of an N1MM `.mc` file so the /// same file works in either program. The macro names are N1MM's too. public static class Messages { /// What an operator gets before touching anything. Twelve lines, so the /// same messages are sent running and searching until the operator writes /// the second twelve. public const string DefaultCw = """ # CW function keys. The first twelve lines are F1 to F12 while running; # add twelve more for the keys while searching. F1 CQ,CQ TEST {MYCALL} {MYCALL} F2 Exch,{SENTRST} {EXCH} F3 TU,TU {MYCALL} F4 MyCall,{MYCALL} F5 HisCall,! F6 QSO B4,QSO B4 F7 ?,? F8 Agn,AGN F9 Nr?,NR? F10 Call?,CALL? F11 Spot, F12 Wipe, """; /// Phone messages name a recording to play; the text is what would be said. public const string DefaultPhone = """ # Phone function keys. F1 CQ,CQ CONTEST {MYCALL} F2 Exch,{EXCH} F3 TU,THANK YOU {MYCALL} F4 MyCall,{MYCALL} F5 HisCall,! F6 QSO B4,QSO BEFORE F7 ?,PLEASE REPEAT F8 Agn,AGAIN F9 Nr?,NUMBER PLEASE F10 Call?,YOUR CALL PLEASE F11 Spot, F12 Wipe, """; /// The digital window's twenty-four buttons. N1MM keeps its own set in its /// admin database, which is not a file this program reads, so these are /// written from N1MM's published digital macro list: `{TX}` starts the /// transmission, `{RX}` ends it, and the text macros are the ones every /// other message uses. public const string DefaultDigital = """ # The digital window's macro buttons, three rows of eight. CQ,{TX}CQ CQ DE {MYCALL} {MYCALL} CQ K{ENTER}{RX} Exch,{TX}{CALL} DE {MYCALL} {SENTRST} {EXCH} {SENTRST} {EXCH} K{ENTER}{RX} TU,{TX}{CALL} TU DE {MYCALL} QRZ{ENTER}{RX}{LOG} MyCall,{TX}{MYCALL} {MYCALL} K{ENTER}{RX} HisCall,{TX}{CALL} DE {MYCALL} K{ENTER}{RX} QSO B4,{TX}{CALL} QSO B4 QRZ DE {MYCALL}{ENTER}{RX} Agn?,{TX}AGN AGN DE {MYCALL} K{ENTER}{RX} Nr?,{TX}NR? NR? DE {MYCALL} K{ENTER}{RX} Call?,{TX}CALL? CALL? DE {MYCALL} K{ENTER}{RX} RST?,{TX}RST? RST? DE {MYCALL} K{ENTER}{RX} QRZ,{TX}QRZ DE {MYCALL} {MYCALL} K{ENTER}{RX} 5NN,{TX}{SENTRST} {SENTRST} K{ENTER}{RX} Test,{TX}RYRYRYRYRYRYRYRY{ENTER}{RX} Grab,{TX}{CALL} DE {MYCALL} K{ENTER}{RX} Wipe,{WIPE} Log,{LOG} Run,{RUN} S&&P,{S&P} Stack,{STACKANOTHER} Pop,{LOGTHENPOP} Spot,{SPOTME} 73,{TX}73 GL DE {MYCALL}{ENTER}{RX} QRL?,{TX}QRL? DE {MYCALL}{ENTER}{RX} Stop,{STOPTX} """; /// The stored digital macros, or the built-in ones while the operator has /// not written their own. public static DigitalMacros Digital(string stored) => DigitalMacros.Parse(stored.Trim().Length > 0 ? stored : DefaultDigital); public static string DefaultFor(ModeCategory mode) => mode == ModeCategory.Phone ? DefaultPhone : DefaultCw; /// The stored file for that mode, or the built-in one while the operator /// has not written their own. public static MessageFile For(ModeCategory mode, string cw, string phone) { string stored = mode == ModeCategory.Phone ? phone : cw; return MessageFile.Parse(stored.Trim().Length > 0 ? stored : DefaultFor(mode)); } }