/// <summary> Initializes this object. </summary> /// <param name="transport"> The transport layer. </param> /// <param name="fieldSeparator"> The field separator. </param> /// <param name="commandSeparator"> The command separator. </param> /// <param name="escapeCharacter"> The escape character. </param> /// <param name="sendBufferMaxLength"> The maximum size of the send buffer</param> private void Init(ITransport transport, char fieldSeparator, char commandSeparator, char escapeCharacter, int sendBufferMaxLength) { _controlToInvokeOn = null; _receiveCommandQueue = new ReceiveCommandQueue(DisposeStack, this); _communicationManager = new CommunicationManager(DisposeStack, transport, _receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter); _sender = new Sender(_communicationManager, _receiveCommandQueue); _sendCommandQueue = new SendCommandQueue(DisposeStack, this, _sender, sendBufferMaxLength); _receiveCommandQueue.NewLineReceived += (o, e) => InvokeNewLineEvent(NewLineReceived, e); _sendCommandQueue.NewLineSent += (o, e) => InvokeNewLineEvent(NewLineSent, e); _fieldSeparator = fieldSeparator; _commandSeparator = commandSeparator; PrintLfCr = false; Command.FieldSeparator = _fieldSeparator; Command.CommandSeparator = _commandSeparator; Command.PrintLfCr = PrintLfCr; Escaping.EscapeChars(_fieldSeparator, _commandSeparator, escapeCharacter); _callbackList = new Dictionary <int, MessengerCallbackFunction>(); //CurrentSentLine = ""; CurrentReceivedLine = ""; }
/// <summary> Initialises this object. </summary> /// <param name="transport"> The transport layer. </param> /// <param name="fieldSeparator"> The field separator. </param> /// <param name="commandSeparator"> The command separator. </param> /// <param name="escapeCharacter"> The escape character. </param> private void Init(ITransport transport, char fieldSeparator, char commandSeparator, char escapeCharacter) { _controlToInvokeOn = null; _sendCommandQueue = new SendCommandQueue(DisposeStack, this); _receiveCommandQueue = new ReceiveCommandQueue(DisposeStack, this); _communicationManager = new CommunicationManager(DisposeStack, transport, _receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter); _fieldSeparator = fieldSeparator; _commandSeparator = commandSeparator; Escaping.EscapeChars(fieldSeparator, commandSeparator, escapeCharacter); _callbackList = new Dictionary <int, MessengerCallbackFunction>(); PrintLfCr = false; }
/// <summary> Initialises this object. </summary> /// <param name="communications"> The Serial port object. </param> /// <param name="fieldSeparator"> The field separator. </param> /// <param name="commandSeparator"> The command separator. </param> /// <param name="escapeCharacter"> The escape character. </param> private void Init(SerialPortManager communications, char fieldSeparator, char commandSeparator, char escapeCharacter) { _controlToInvokeOn = null; _communications = communications; _communications = communications; _fieldSeparator = fieldSeparator; _commandSeparator = commandSeparator; _escapeCharacter = escapeCharacter; communications.EolDelimiter = _commandSeparator; Escaping.EscapeChars(fieldSeparator, commandSeparator, escapeCharacter); _callbackList = new Dictionary <int, MessengerCallbackFunction>(); PrintLfCr = false; _communications.NewLineReceived += NewSerialDataReceived; }
/// <summary> Initializes this object. </summary> /// <param name="transport"> The transport layer. </param> /// <param name="boardType"> Embedded Processor type. Needed to translate variables between sides. </param> /// <param name="fieldSeparator"> The field separator. </param> /// <param name="commandSeparator"> The command separator. </param> /// <param name="escapeCharacter"> The escape character. </param> /// <param name="sendBufferMaxLength"> The maximum size of the send buffer</param> private void Init(ITransport transport, BoardType boardType, char fieldSeparator, char commandSeparator, char escapeCharacter, int sendBufferMaxLength) { //Logger.Open(@"sendCommands.txt"); Logger.DirectFlush = true; _receiveCommandQueue = new ReceiveCommandQueue(HandleMessage); _communicationManager = new CommunicationManager(transport, _receiveCommandQueue, boardType, commandSeparator, fieldSeparator, escapeCharacter); _sendCommandQueue = new SendCommandQueue(_communicationManager, sendBufferMaxLength); PrintLfCr = false; _receiveCommandQueue.NewLineReceived += (o, e) => InvokeNewLineEvent(NewLineReceived, e); _sendCommandQueue.NewLineSent += (o, e) => InvokeNewLineEvent(NewLineSent, e); Escaping.EscapeChars(fieldSeparator, commandSeparator, escapeCharacter); _callbackList = new Dictionary <int, MessengerCallbackFunction>(); _sendCommandQueue.Start(); _receiveCommandQueue.Start(); }