public SensorArray(CommunicationTypes communicationTypes, BumpSensorLocations bumpSensorLocations) { communicationArray = new CommunicationArray(communicationTypes); bumpSensors = new BumpSensors(bumpSensorLocations); bumpSensors.OnBump += new EventHandler <BumpEventArgs>(Bump); }
private void Initialize(string name, int listenPort, CommunicationTypes communicationType) { this.name = name; this.clientInstances = new Dictionary <string, MonoExpanderInstance>(); this.typeCache = new Dictionary <string, Type>(); switch (communicationType) { case CommunicationTypes.SignalR: throw new NotImplementedException(); //this.serverCommunication = new ExpanderCommunication.SignalRServer( // listenPort: listenPort, // dataReceivedAction: DataReceived); break; case CommunicationTypes.Netty: this.serverCommunication = new ExpanderCommunication.NettyServer( logger: this.log, listenPort: listenPort, dataReceivedAction: DataReceived, clientConnectedAction: ClientConnected); break; default: throw new ArgumentException("Communication Type"); } Executor.Current.Register(this); }
private void Initialize(string name, int listenPort, CommunicationTypes communicationType) { this.name = name; this.clientInstances = new Dictionary<string, MonoExpanderInstance>(); this.typeCache = new Dictionary<string, Type>(); switch (communicationType) { case CommunicationTypes.SignalR: this.serverCommunication = new ExpanderCommunication.SignalRServer( listenPort: listenPort, dataReceivedAction: DataReceived); break; case CommunicationTypes.Netty: this.serverCommunication = new ExpanderCommunication.NettyServer( listenPort: listenPort, dataReceivedAction: DataReceived, clientConnectedAction: ClientConnected); break; default: throw new ArgumentException("Communication Type"); } Executor.Current.Register(this); }
/// <summary> /// Constructor /// </summary> /// <param name="id">The bots ID</param> /// <param name="communicationType">The bots communication type</param> /// <param name="bumpSensorLocations"></param> public EPROM(Guid id, CommunicationTypes communicationType, BumpSensorLocations bumpSensors) { this.communicationType = communicationType; this.bumpSensors = bumpSensors; this.id = id; FileHelper.SaveROM(id, this); history = new History(); }
/// <summary> /// Constructor /// </summary> /// <param name="communicationType">The bots available communication type</param> public CommunicationArray(CommunicationTypes communicationTypes) { this.communicationTypes = communicationTypes; transmitters = new List <TransmitterBase>(); if ((communicationTypes & CommunicationTypes.IR) != 0) { transmitters.Add(new IRTransmitter()); } if ((communicationTypes & CommunicationTypes.RF) != 0) { transmitters.Add(new RFTransmitter()); } }
public FrameClass(byte commandControlType, byte commandIdentifier, IPAddress commandIPAddr, CommunicationTypes commType) { this.controlType = commandControlType; this.identifier = commandIdentifier; this.ipAddr = commandIPAddr; this.commType = commType; switch (commType) { case CommunicationTypes.UDP: this.length = (ushort)4; this.maxLength = (ushort)4; break; case CommunicationTypes.Broadcast: this.length = (ushort)8; this.maxLength = (ushort)8; break; } this.optionList = DataListManger.ReadOptionQueueForCommand(this.ipAddr, commandControlType, ref this.length, ref this.maxLength); this.frame = new byte[(int)this.length]; this.createCommand(); }
//-------------------------------------------------------------------------------------------------// public EquipmentEngine(string rootFilePath) : base(rootFilePath) { const string STRLOG_MethodName = "EquipmentEngine"; Logfile.WriteCalled(null, STRLOG_MethodName); int initialiseDelay = 0; bool hardwarePresent = true; try { // // Determine if hardware is to be used or whether this is running without hardware // for testing and debugging // try { hardwarePresent = XmlUtilities.GetBoolValue(this.xmlNodeEquipmentConfig, Consts.STRXML_hardwarePresent, false); } catch { // Key not found or invalid so assume hardware is present } // // Create an instance of the FlexMotion class, must be done before creating the Radiation Counter class // if (hardwarePresent == true) { this.flexMotion = new FlexMotionCntl(this.xmlNodeEquipmentConfig); } else { this.flexMotion = new FlexMotionNone(this.xmlNodeEquipmentConfig); } initialiseDelay += this.flexMotion.InitialiseDelay; // // Get the serial LCD communication type // XmlNode xmlNodeSerialLcd = XmlUtilities.GetXmlNode(this.xmlNodeEquipmentConfig, Consts.STRXML_serialLcd); string strSerialLcdCommType = XmlUtilities.GetXmlValue(xmlNodeSerialLcd, Consts.STRXML_type, false); this.serialLcdCommType = (CommunicationTypes)Enum.Parse(typeof(CommunicationTypes), strSerialLcdCommType); // // Create an instance of the SerialLcd class, must be done before creating the Radiation Counter class // if (hardwarePresent == true) { if (this.serialLcdCommType == CommunicationTypes.Network) { this.serialLcdTcp = new SerialLcdTcp(this.xmlNodeEquipmentConfig); this.serialLcd = this.serialLcdTcp; } else if (this.serialLcdCommType == CommunicationTypes.Serial) { this.serialLcdSer = new SerialLcdSer(this.xmlNodeEquipmentConfig); this.serialLcd = this.serialLcdSer; } else if (this.serialLcdCommType == CommunicationTypes.None) { this.serialLcdNone = new SerialLcdNone(this.xmlNodeEquipmentConfig); this.serialLcd = this.serialLcdNone; } else { throw new ArgumentException(STRERR_SerialLcdCommsTypeNotSpecified); } } else { this.serialLcdNone = new SerialLcdNone(this.xmlNodeEquipmentConfig); this.serialLcd = this.serialLcdNone; } initialiseDelay += this.serialLcd.InitialiseDelay; // // Get the radiation counter type // XmlNode xmlNodeRadiationCounter = XmlUtilities.GetXmlNode(this.xmlNodeEquipmentConfig, Consts.STRXML_radiationCounter, false); string strCounterType = XmlUtilities.GetXmlValue(xmlNodeRadiationCounter, Consts.STRXML_type, false); this.radiationCounterType = (RadiationCounterTypes)Enum.Parse(typeof(RadiationCounterTypes), strCounterType); // // Create an instance of the radiation counter class // if (this.radiationCounterType == RadiationCounterTypes.ST360) { // // Get the ST360 counter communication type // XmlNode xmlNodeST360Counter = XmlUtilities.GetXmlNode(this.xmlNodeEquipmentConfig, Consts.STRXML_st360Counter); string strST360CounterCommType = XmlUtilities.GetXmlValue(xmlNodeST360Counter, Consts.STRXML_type, false); this.st360CounterCommType = (CommunicationTypes)Enum.Parse(typeof(CommunicationTypes), strST360CounterCommType); // // Create an instance of the ST360 counter class depending on the communication type // if (hardwarePresent == true) { if (this.st360CounterCommType == CommunicationTypes.Network) { this.st360CounterTcp = new ST360CounterTcp(this.xmlNodeEquipmentConfig); this.st360Counter = st360CounterTcp; } else if (this.st360CounterCommType == CommunicationTypes.Serial) { this.st360CounterSer = new ST360CounterSer(this.xmlNodeEquipmentConfig); this.st360Counter = st360CounterSer; } else { throw new ArgumentException(STRERR_ST360CounterCommsTypeNotSpecified); } } else { this.st360CounterNone = new ST360CounterNone(this.xmlNodeEquipmentConfig); this.st360Counter = st360CounterNone; } initialiseDelay += this.st360Counter.InitialiseDelay; } else if (this.radiationCounterType == RadiationCounterTypes.Physics) { if (hardwarePresent == true) { if (this.serialLcdCommType == CommunicationTypes.Network) { this.physicsCounter = new PhysicsCounter(this.xmlNodeEquipmentConfig, this.serialLcdTcp, this.flexMotion); } else if (this.serialLcdCommType == CommunicationTypes.Serial) { this.physicsCounter = new PhysicsCounter(this.xmlNodeEquipmentConfig, this.serialLcdSer, this.flexMotion); } else { throw new ArgumentException(STRERR_SerialLcdCommsTypeNotSpecified); } } else { this.physicsCounter = new PhysicsCounter(this.xmlNodeEquipmentConfig, this.serialLcdNone, this.flexMotion); } initialiseDelay += this.physicsCounter.InitialiseDelay; } else { throw new ArgumentException(STRERR_RadiationCounterTypeNotSpecified); } // // Update the power initialisation delay // this.powerupInitialiseDelay = initialiseDelay; Logfile.Write(STRLOG_InitialiseDelay + initialiseDelay.ToString() + STRLOG_Seconds); } catch (Exception ex) { // // Log the message and throw the exception back to the caller // Logfile.WriteError(ex.Message); throw; } Logfile.WriteCompleted(null, STRLOG_MethodName); }
public static void Fill( this MimeMessage message, ICreativeSettingsFinder finder, ICollection <ReusableValue> reusableValues, Creative creative, CommunicationTypes ct, ApplicationUser u, Contact c, object model) { Requires.NonNull(message, nameof(message)); Requires.NonNull(creative, nameof(creative)); var filler = new CommunicationsFiller(finder, reusableValues); if (c != null) { message.ContactId(c.ContactId); } else if (u != null) { message.ContactId(u.ContactId); } var context = new Dictionary <string, object> { { "User", u }, { "Contact", c }, { "Model", model } }; var compiledContext = new CommunicationsFiller.CompiledContext(context); var indexerByName = new Dictionary <string, IDictionary <string, string> >(); MimeEntity textPart = null; MimeEntity htmlPart = null; switch (ct) { case CommunicationTypes.Email: message.Subject = filler.Evaluate(creative, z => z.EmailSubject, compiledContext); textPart = new TextPart(TextFormat.Text) { Text = filler.Evaluate(creative, z => z.EmailTextBody, compiledContext) }; htmlPart = new TextPart(TextFormat.Html) { Text = filler.Evaluate(creative, z => z.EmailHtmlBody, compiledContext) }; break; case CommunicationTypes.Sms: textPart = new TextPart(TextFormat.Text) { Text = filler.Evaluate(creative, z => z.TextMessageBody, compiledContext) }; break; default: throw new UnexpectedSwitchValueException(ct); } if (textPart == null || htmlPart == null) { message.Body = textPart ?? htmlPart; } else { message.Body = new MultipartAlternative(textPart, htmlPart); } }
public void CommunicationInRange(CommunicationTypes communicationType) { }
protected TransmitterBase(CommunicationTypes communicationType) { this.communicationType = communicationType; }