public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate) { m_port = port; m_accountsAuthenticate = accountsAuthenticate; m_scenes = scenes; m_programMinorVersion = 63; m_programMajorVersion = 0; m_programName = "OpenSimulator"; m_transmitter = new Transmitter(port); StartListener(); }
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate) { m_port = port; m_accountsAuthenticate = accountsAuthenticate; m_scenes = scenes; m_programMinorVersion = 63; m_programMajorVersion = 0; m_programName = "OpenSimulator"; m_transmitter = new Transmitter(port); m_clientThread = new Thread(StartListener); m_clientThread.Name = "MXPThread"; m_clientThread.IsBackground = true; m_clientThread.Start(); ThreadTracker.Add(m_clientThread); }
private void Start() { Transmitters = FindObjectsOfType <Transmitter>(); foreach (TransmissionLink link in TransmissionLinks) { TransmissionLine line = Instantiate(TransmissionLinePrefab); line.Link = link; line.Controller = this; Transmitter t1 = Transmitters.First(t => t.Id == link.Transmitter1); Transmitter t2 = Transmitters.First(t => t.Id == link.Transmitter2); Vector3[] pos = new Vector3[] { Transmitters.First(t => t.Id == link.Transmitter1).transform.position, Transmitters.First(t => t.Id == link.Transmitter2).transform.position }; line.LineRenderer.SetPositions(pos); line.LineRenderer.startWidth = .1f; line.LineRenderer.startWidth = .2f; t1.Links.Add(new Link() { Other = t2, TLink = link }); t2.Links.Add(new Link() { Other = t1, TLink = link }); } }
private async void AssignButton_Click(object sender, EventArgs e) { buttonAssign.Enabled = false; comboBoxTFSProject.Enabled = false; comboBoxTFSTestSuites.Enabled = false; //Transmitter.TestCaseStatusChanged += DispatchTestCaseStatus; string selectedTestSuiteId = Regex.Match(SelectedTestSuite, @"(\d+)").ToString(); Transmitter Transmitter = new Transmitter(SelectedProject, selectedTestSuiteId); string Completed = await Transmitter.ExecuteSuites(); //while (await GetAvailableTestSuites()) //{ // await GetAvailableTestSuites(); // CurrentTestSuiteName = AvilableTestSuiteIds.FirstOrDefault().Split(':').LastOrDefault(); // CurrentTestSuiteId = int.Parse(AvilableTestSuiteIds.FirstOrDefault().Split(':').FirstOrDefault()); // SetupSettings(); // await _Tfs.UpdateWorkItemById(CurrentTestSuiteId, "/fields/System.State", "In Progress"); // StartExecution(); //} buttonAssign.Enabled = true; comboBoxTFSProject.Enabled = true; comboBoxTFSTestSuites.Enabled = true; MessageBox.Show("(1)None of Test suite state = 'In Planning' (2)Test Suites should have valid SWAT testcase "); }
void Start() { gyroscope = magnetometer = accelerometer = Vector3.zero; instance = new Transmitter(); server = FindObjectOfType <UDPClient> (); }
public AddWeaponOrPetEmailHandler(IClientHelper clientHelper, Transmitter transmitter) { this.clientHelper = clientHelper; this.transmitter = transmitter; }
private void SendDataButton_Click(object sender, EventArgs e) { Transmitter.TransmitData(dataTextBox.Text); }
public void ControlUpdate(motor[] motors, Transmitter tx, Sensors sensors) { if (armed) { if (Modes.BARO_MODE) {//35 degrees max inclination roll.Control(sensors.GetRotation().x, sensors.GetAngularVelocity().x, -tx.GetRoll() * 35); pitch.Control(sensors.GetRotation().z, sensors.GetAngularVelocity().z, -tx.GetPitch() * 35); yaw.Control(sensors.GetRotation().y, sensors.GetAngularVelocity().y, tx.GetYaw() * 50); } //Calculates and applies the force to the motors for (int i = 0; i < 4; i++) { //General force (throttle) motors[i].force = tx.GetThrottle() * 2.0F; //:) This should take into account the air density, air temp, altitude, batteries charge, etc. //Pitch force motors[i].force -= motors[i].position.x * (pitch.p + pitch.i + pitch.d); //Roll force motors[i].force += motors[i].position.z * (roll.p + roll.i + roll.d);// + (-0.1F + Random.value*0.2F); } if (tx.GetYaw() < -0.9 && tx.GetThrottle() < 0.1) { contCyclesBeforeArmUnarm++; } else { contCyclesBeforeArmUnarm = 0; } if (contCyclesBeforeArmUnarm >= 100) { armed = false; Debug.Log("UNARMED"); } } else { for (int i = 0; i < 4; i++) { motors[i].force = 0f; } if (tx.GetYaw() > 0.9 && tx.GetThrottle() < 0.1) { contCyclesBeforeArmUnarm++; } else { contCyclesBeforeArmUnarm = 0; } if (contCyclesBeforeArmUnarm >= 100) { armed = true; Debug.Log("ARMED"); } } }
protected virtual void Start() { receiver = GetComponent <Receiver>(); transmitter = GetComponent <Transmitter>(); OpName = "Operator"; }
private void SpawnEffect(ref HashSet <Vector2Int> redSet, ref HashSet <Vector2Int> greenSet, Transmitter tr) { if (Grid.Instance.GetGridComponent(tr.Location + tr.OutputDirection) == null) { return; } Wire wire = Grid.Instance.GetGridComponent(tr.Location + tr.OutputDirection).GetComponent <Wire>(); Receiver op = Grid.Instance.GetGridComponent(tr.Location + tr.OutputDirection).GetComponent <Receiver>(); Transform effect = null; if (wire != null) { if (wire.HasRed) { effect = Instantiate(wireEffectPrefab, tr.transform.position + (wire.RedParts.Center.transform.position - wire.transform.position), Quaternion.identity); effect.GetComponent <WireEffect>().SetHashSets(ref redSet, ref greenSet); effect.GetComponent <WireEffect>().destTile = wire.Location; effect.GetComponent <WireEffect>().destination = wire.RedParts.Center.transform.position; effect.GetComponent <WireEffect>().SetColor(effect.GetComponent <WireEffect>().redColor); effect.GetComponent <WireEffect>().followColor = WireEffect.FollowColor.RED; } if (wire.HasGreen) { effect = Instantiate(wireEffectPrefab, tr.transform.position + (wire.GreenParts.Center.transform.position - wire.transform.position), Quaternion.identity); effect.GetComponent <WireEffect>().SetHashSets(ref redSet, ref greenSet); effect.GetComponent <WireEffect>().destTile = wire.Location; effect.GetComponent <WireEffect>().destination = wire.GreenParts.Center.transform.position; effect.GetComponent <WireEffect>().SetColor(effect.GetComponent <WireEffect>().greenColor); effect.GetComponent <WireEffect>().followColor = WireEffect.FollowColor.GREEN; } } if (op != null) { if (op.Location + op.InputDirection1 == tr.Location || op.Location + op.InputDirection2 == tr.Location) { effect = Instantiate(wireEffectPrefab, tr.transform.position, Quaternion.identity); effect.GetComponent <WireEffect>().SetHashSets(ref redSet, ref greenSet); effect.GetComponent <WireEffect>().destTile = op.Location; effect.GetComponent <WireEffect>().destination = op.transform.position; effect.GetComponent <WireEffect>().SetColor(effect.GetComponent <WireEffect>().redColor); effect.GetComponent <WireEffect>().followColor = WireEffect.FollowColor.RED; effect.GetComponent <WireEffect>().noSpread = true; } } }
public Processor() { Receiver = new Receiver(); Transmitter = new Transmitter(); }
public void Connect(Transmitter transmitter, Receiver receiver) { this.transmitter = transmitter; this.receiver = receiver; }
public override void Process(Impulse impulse) { Impulse result = null; switch (impulse.Signal) { case SignalType.Response: // There is information coming from one of the nodes switch (impulse.Node) { case Node.Information: // Information couldn't find the meaning. if (impulse.Outcome == Outcome.Failure) { result = new Data { Content = "I do not know.", Outcome = Outcome.Failure, Signal = SignalType.Transmit, }; } else { // i know what you mean. lets memorize it. result = new Word(impulse as Word); result.Outcome = Outcome.Success; result.Signal = SignalType.Response; } break; case Node.Logic: // logic calls upon itself recursively until it reaches a stop condition. That's how thinking is processed in the brain. We are calling upon a thought based // on the response from a previous thought. if (impulse is Word) { // i know this word. lets send it. result = new Word(impulse as Word); result.Outcome = Outcome.Success; result.Signal = SignalType.Transmit; } break; case Node.Memory: if (impulse.Outcome == Outcome.Success) { // I know what it means. Lets send it. //TODO: I might not want to send it. I might want to think about it... is there any history behind the word? what are the implications of the word? result = new Word(impulse as Word); result.Outcome = Outcome.Success; result.Signal = SignalType.Transmit; } else { // Memory doesnt know what it means. if (impulse is Data) { // There is something that i don't know. // Lets see if I can find out what it means. result = new Data { Content = (impulse as Data).Content, Outcome = Outcome.Success, Signal = SignalType.Search }; } } break; default: break; } break; default: Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{impulse?.Signal.ToString() ?? Resources.Constants.Trace.None};{impulse?.Outcome.ToString() ?? Resources.Constants.Trace.None}"); return; } if (result != null) { Transmitter.SendSignal(result); Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{result.Signal};{result.Outcome}"); } else { Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{SignalType.None};{Outcome.Failure};{NodeStatus.Exception}"); } }
public override void Send(byte[] information) { Transmitter.Send(information); _logger.Log($"Data sent successfully at {DateTime.Now} from loggable transmitter"); }
private void Transmitter_DataReceived(object sender, SerialDataReceivedEventArgs e) { ack_Received = Transmitter.ReadExisting(); textBox2.AppendText(ack_Received + '\n'); //添加文本 textBox2.ScrollToCaret(); //自动显示至最后行 }
private void button13_Click(object sender, EventArgs e) //发送字符数据 { if (Transmitter.IsOpen) //如果串口开启 { if (Ack_thread != null) { Ack_thread.Abort(); //无视之前的数据,关闭线程以停止重发 } if (SendTbox.Text.Trim() != "") //如果框内不为空则 { if (comboBox5.Text == "TCP" || comboBox5.Text == "UDP") { byte[] byteArray = System.Text.Encoding.Default.GetBytes(SendTbox.Text.Trim()); List <byte> byteList = new List <byte>(); byte[] tcp_byteArray = byteList.ToArray(); byteList.AddRange(byteArray); byte init_checksum = 0; byteList.Insert(0, init_checksum); byteList.Insert(0, init_checksum); ushort check_result = check_sum(byteList, byteList.Count); byte[] checksum = BitConverter.GetBytes(check_result).Reverse().ToArray(); if (even) { byteList.RemoveRange(0, 2); for (int i = checksum.Length - 1; i >= 0; i--) { byteList.Insert(0, checksum[i]); } } else { byteList.RemoveRange(0, 2); byteList.RemoveRange(byteList.Count - 1, 1); for (int i = checksum.Length - 1; i >= 0; i--) { byteList.Insert(0, checksum[i]); } } tcp_byteArray = byteList.ToArray(); even = true; Transmitter.Write(tcp_byteArray, 0, tcp_byteArray.Length); if (comboBox5.Text == "TCP") { tcp_byteArray_resend = tcp_byteArray; //备份数据 ThreadStart Ack_threadStart = new ThreadStart(resend); //通过ThreadStart委托告诉子线程执行什么方法 Ack_thread = new Thread(Ack_threadStart); Ack_thread.Start(); //启动新线程 } } else { Transmitter.Write(SendTbox.Text.Trim() + '\n');//写数据 } } else { MessageBox.Show("发送框没有数据"); } } else { MessageBox.Show("串口未打开"); } }
public void Flush() { var items = Buffer.Dequeue(); Transmitter.SendAsync(items, this.TransmissionTimeout); }
public AddFacadeEmailHandler(IClientHelper clientHelper, Transmitter transmitter) { this.clientHelper = clientHelper; this.transmitter = transmitter; }
public void Setup() { _data = new Data() { Id = 2343, Name = "Govind Kumar", Description = "Software Developer" }; _transmitter = new Transmitter<Data>(_data); _receiver = new Receiver<Data>(); }
private async void SaveItem(Transmitter transmitter) { await _transmitterProvider.SaveAsync(transmitter); }
public override void BeforePatch() { Receiver.Register(); Transmitter.Register(); }
public TelemetrySerializerStub(Transmitter t) : base(t) { }
public override void Initialize(Transmitter transmitter) { base.Initialize(transmitter); this.applicationLifecycle.Stopping += this.HandleApplicationStoppingEvent; }
public Receiver(Transmitter transmitter, Channel channel) : this(new RemoteControl(transmitter, channel)) { }
public void NullifyInCurrentTransmitter() { this.LastGameObject = this._inCurrentTransmitter.gameObject; this._inCurrentTransmitter = null; }
public async System.Threading.Tasks.Task <IActionResult> NewTransmitter(Transmitter transmitter_temp) { //handling user-may-occur mistakes if (transmitter_temp.modulation_type.StartsWith("Select")) { ViewData["message"] = "Please fill the modulation type"; return(View(transmitter_temp)); } //get session id (we will use it when updating data and handling errors) sessionID_s = HttpContext.Session.GetString("Session"); sessionID = Guid.Parse(sessionID_s); Data current = new Data(); foreach (KeyValuePair <Guid, Data> sds in Program.data) { if (sds.Key.Equals(sessionID)) { current = sds.Value; } } //If the transmitter name is null we give a default name that specifies its number String def_name = null; //because we change the default name after the Radar added we we should keep it in mind to it is a default given name bool isNamed = false; if (String.IsNullOrEmpty(transmitter_temp.name)) { int count = 0; try { count = await _session.GetTransmitterNumber(); } catch (Exception e) { // log exception here ViewData["message"] = e.Message.ToString() + " Error"; await _session.Rollback(); count = -1; return(View(transmitter_temp)); } finally { _session.CloseTransaction(); } def_name = "Transmitter " + count; //keep it in mind isNamed = true; } else { def_name = transmitter_temp.name; } Guid key = Guid.NewGuid(); Transmitter transmitter = new Transmitter(key, def_name, transmitter_temp.modulation_type, transmitter_temp.max_frequency, transmitter_temp.min_frequency, transmitter_temp.power); transmitter.Isnamed = isNamed; //save our transmitter to database try { _session.BeginTransaction(); await _session.SaveTransmitter(transmitter); await _session.Commit(); } catch (Exception e) { // log exception here ViewData["message"] = e.Message.ToString() + " Error"; await _session.Rollback(); return(View(transmitter)); } finally { _session.CloseTransaction(); } //Add our transmitter to Data model and update the dictionary so we can use its id when we're adding Radar entity current.Transmitter = transmitter; return(RedirectToAction("Preliminary", "Antenna")); }
void DestroyTransmitter(Transmitter t) { Destroy(t.gameObject); }
void Start() { //Multicopter motor configuration //Quadcopter motors = new motor[4]; motors[0] = new motor(new Vector3(1, 0, 1), 0f, true); //Front left CW motors[1] = new motor(new Vector3(1, 0, -1), 0f, false); //Front righ CCW motors[2] = new motor(new Vector3(-1, 0, -1), 0f, true); //Rear right CW motors[3] = new motor(new Vector3(-1, 0, 1), 0, false); //Rear left CCW tx = new Transmitter(); sensors = new Sensors(GetComponent<Rigidbody>()); controller = new CFController(0); armed = true; }
public override void Process(Impulse impulse) { Impulse response = null; switch (impulse.Signal) { case SignalType.Receive: // Information is being received from perception. Lets see if I know what it means. if (impulse is Data) { var query = impulse as Data; Entity.Word dbWord = null; try { dbWord = RepositoryManager.Language.GetWordByName(query.Content).FirstOrDefault(); } catch (Exception ex) { Trace.WriteLine(string.Format($"{Resources.Constants.Trace.Date},{this.ToString()};{Resources.Constants.Trace.GetWord};{NodeStatus.Exception};{ex.Message}")); } if (dbWord != null) { // I know what it means. response = Map.EntityToSignal(dbWord); response.Signal = SignalType.Response; response.Outcome = Outcome.Success; } else { // Don't know what it means. response = new Data(impulse as Data); response.Signal = SignalType.Response; response.Outcome = Outcome.Failure; } } break; case SignalType.Request: //TODO: Logic requests a word from memory. break; case SignalType.Response: // A response is coming from logic. Lets memorize it. if (impulse.Outcome == Outcome.Success) { if (impulse is Word) { Entity.Word dbWord = Map.SignalToEntity(impulse as Word); if (dbWord == null) { Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{Resources.Constants.Trace.AddWord};{Outcome.Failure.ToString()};{Resources.Constants.Trace.NoWordType}"); } else { int wordId = RepositoryManager.Language.AddWord(dbWord); if (wordId == 0) { Trace.WriteLine(string.Format("{0};{1};{2};{3};{4}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.AddWord, Outcome.Failure.ToString(), wordId)); } else { Trace.WriteLine(string.Format("{0};{1};{2};{3};{4}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.AddWord, Outcome.Success.ToString(), wordId)); } } } } break; default: System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.Default)); return; } if (response != null) { Transmitter.SendSignal(response); System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), response.Signal)); } }
// Use this for initialization void Start() { trans = TransmitterParent.GetComponent <Transmitter>(); }
protected abstract void React(Transmitter source, string action);
public Processor() { Transmitter = new Transmitter(); }
public Processor() { Collector = new Collector(); Transmitter = new Transmitter(); }
public async Task Transmitter1() { string indexName = string.Format("delete-me-{0}", Guid.NewGuid()); using (var service = await SdkHelper.CreateService()) { Index index = await service.Indexes.RecreateAsync(indexName); Assert.False(index.Disabled); await Task.Delay(2000); // Submit event using TransmitterArgs const string Source = "splunk-sdk-tests"; const string SourceType = "splunk-sdk-test-event"; const string Host = "test-host"; var transmitterArgs = new TransmitterArgs { Host = Host, Source = Source, SourceType = SourceType, }; Transmitter transmitter = service.Transmitter; SearchResult result; //// TODO: Check contentss result = await transmitter.SendAsync( MockContext.GetOrElse(string.Format("1, {0}, {1}, simple event", DateTime.Now, indexName)), indexName, transmitterArgs); Assert.NotNull(result); result = await transmitter.SendAsync( MockContext.GetOrElse(string.Format("2, {0}, {1}, simple event", DateTime.Now, indexName)), indexName, transmitterArgs); Assert.NotNull(result); using (MemoryStream stream = new MemoryStream()) { using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8, 4096, leaveOpen: true)) { writer.WriteLine( MockContext.GetOrElse(string.Format("1, {0}, {1}, stream event", DateTime.Now, indexName))); writer.WriteLine( MockContext.GetOrElse(string.Format("2, {0}, {1}, stream event", DateTime.Now, indexName))); } stream.Seek(0, SeekOrigin.Begin); await transmitter.SendAsync(stream, indexName, transmitterArgs); } await index.PollForUpdatedEventCount(4); var search = string.Format( "search index={0} host={1} source={2} sourcetype={3}", indexName, Host, Source, SourceType); using (SearchResultStream stream = await service.SearchOneShotAsync(search)) { Assert.Equal(0, stream.FieldNames.Count); Assert.False(stream.IsFinal); Assert.Equal(0, stream.ReadCount); foreach (SearchResult record in stream) { var fieldNames = stream.FieldNames; Assert.Equal(14, fieldNames.Count); Assert.Equal(14, record.FieldNames.Count); Assert.Equal(fieldNames.AsEnumerable(), record.FieldNames.AsEnumerable()); var memberNames = record.GetDynamicMemberNames(); var intersection = fieldNames.Intersect(memberNames); Assert.Equal(memberNames, intersection); } Assert.Equal(14, stream.FieldNames.Count); Assert.Equal(4, stream.ReadCount); } } }
public override void Initialize(Transmitter transmitter) { this.OnInitialize(transmitter); }