/// <summary> /// Makes it easier to retrieve the most current field values /// </summary> /// <param name="dataIn">data to be analysed</param> /// <param name="currentLocation">Extracted location from the neutriono</param> /// <param name="picValue">Extracted picValue from the neutriono</param> /// <param name="barcode">Extracted barcode from the neutriono</param> private void GetStandardFields( Neutrino dataIn, out string currentLocation, out string picValue, out string barcode) { byte[] vi = dataIn.GetRawField("SourceLocation"); currentLocation = Encoding.GetEncoding(1252).GetString(vi); vi = dataIn.GetRawField("PIC"); picValue = Encoding.GetEncoding(1252).GetString(vi); vi = dataIn.GetRawField("Barcode"); barcode = Encoding.GetEncoding(1252).GetString(vi); }
/// <summary> /// Will be called each time a telegram has arrived. /// </summary> /// <param name="theInstance">Communication Instance</param> /// <param name="dataIn">data to be analysed</param> /// <param name="dataOut">The data to send back. If null then no data will be send back.</param> public virtual void Process(string theInstance, Neutrino dataIn, out List <Neutrino> dataOut) { Neutrino theNeutrino = null; // Default: We will not send anything back... dataOut = null; // What kind of telegram came in? byte[] vi = dataIn.GetRawField(StandardTelegramFieldNames.TelegramId); logger.InfoMethod("Processing " + dataIn.TheName + "."); switch (Encoding.GetEncoding(1252).GetString(vi)) { // Tote passed a scanner. PLC is waiting for destination location from MFC. case "01": OnDestinationRequest(dataIn, out theNeutrino); break; // Tote passed a waiting point scanner. PLC is waiting for destination location from MFC // while having the tote stop. case "02": OnWaitingPointRequest(dataIn, out theNeutrino); break; // Tote has passed a message point case "03": OnMessagePointRequest(dataIn); break; case "04": OnRequestAtToteStart(dataIn, out theNeutrino); break; // Tote has been sorted out after a destination request case "11": OnSortationReport(dataIn); break; // Tote has been sorted out after a waiting point request case "12": OnSortationReportWaitingPoint(dataIn); break; case "14": OnSortationReportToteStart(dataIn); break; // MFC State telegram request. MFC is requested to send it's state back to the PLC. case "61": OnMFCState(dataIn, out theNeutrino); break; case "81": OnPLCLoggingInfo(dataIn); break; // PLC reports it's state to the MFC. case "91": OnPLCState(dataIn, out theNeutrino); break; // Server sends back it's watchdog telegram case "98": OnWatchdogReply(dataIn, out theNeutrino); break; // Client should send it's watchdog telegram case "99": OnWatchdogRequest(dataIn, out theNeutrino); break; } if (theNeutrino != null) { dataOut = new List <Neutrino>(); dataOut.Add(theNeutrino); } }
/// <summary> /// Returns the value of the specified field as a string /// </summary> /// <param name="dataIn">data to be analysed</param> /// <param name="field">Key name for which data should be extracted from the neutrino</param> /// <returns>data found for given key</returns> private string GetField(Neutrino dataIn, string field) { return(Encoding.GetEncoding(1252).GetString(dataIn.GetRawField(field))); }