public GetDeviceIdResponse NewGetDeviceIdResponse(DeviceID device) { return(new GetDeviceIdResponse { device = device, }); }
public GetThirdPartyDeviceIdResponse NewGetThirdPartyDeviceIdResponse(DeviceID device) { return(new GetThirdPartyDeviceIdResponse { device = device }); }
public ReleaseDeviceId NewReleaseDeviceId(DeviceID deviceId) { return(new ReleaseDeviceId { device = deviceId }); }
protected override void Execute(CodeActivityContext context) { var deviceID = (int)DeviceID.Get(context); var dynamicEnergyThreshold = (Boolean)DynamicEnergyThreshold.Get(context); var energyThresholdValue = (Int32)EnergyThresholdValue.Get(context); if (energyThresholdValue <= 0) { energyThresholdValue = 300; } var pauseThreshold = PauseThreshold.Get(context); if (pauseThreshold <= 0) { pauseThreshold = 0.8; } double?timeoutSeconds = TimeoutSeconds.Get(context); double?phraseTimeLimit = PhraseTimeLimit.Get(context); var inputLanguage = InputLanguage.Get(context); if (inputLanguage.Length < 2) { inputLanguage = "en-US"; } var apiKey = APIKey.Get(context); var username = Username.Get(context); var password = Password.Get(context); var engine = Engine; var filePath = FilePath.Get(context); IEnumerable <object> inputParameters = new object [] { deviceID, filePath, inputLanguage, apiKey, username, password, engine, dynamicEnergyThreshold, energyThresholdValue, pauseThreshold, timeoutSeconds, phraseTimeLimit }; OutputParameters.Set(context, inputParameters); }
/// <summary> /// 通讯状态观察 /// </summary> private void CommunicationObser(object sender, System.Timers.ElapsedEventArgs e) { try { communicationobserve_timer.Enabled = false; //先判断小车是否已经掉线 if (LastRecLong > 2) { //如果接受消息时间已经大于2秒,则认为车子掉线了。 DelegateState.InvokeDispatchStateEvent(this.DeviceID.ToString() + "车,已经掉线,将在1秒后重新尝试连接..."); //通知调度程序 小车已经掉线 CarBaseStateInfo car = new CarBaseStateInfo(); car.bIsCommBreak = true; car.AgvID = this.DeviceID; DelegateState.InvokeCarFeedbackEvent(car); if (LastConnectLong > 3) { //如果车子掉线且连接时间超过3秒则需要重连 LogHelper.WriteLog("重连小车" + DeviceID.ToString()); ReConnect(); } } } catch (Exception ex) { DelegateState.InvokeDispatchStateEvent(this.DeviceID.ToString() + "车,观察线程异常"); LogHelper.WriteErrorLog(ex); } finally { { communicationobserve_timer.Enabled = true; } } }
public RamLocation(string Name, byte StartAddress, byte EndAddress, DeviceID DeviceModel) { this.Name = Name; this.StartAddress = StartAddress; this.EndAddress = EndAddress; this.DeviceModel = DeviceModel; }
/// <summary> /// 通讯状态观察 /// </summary> private void CommunicationObser(object sender, System.Timers.ElapsedEventArgs e) { try { communicationobserve_timer.Enabled = false; //接收超时,进行重新连接 if (LastConnectLong > 3) { LogHelper.WriteLog("重连" + DeviceID.ToString() + "号IO设备"); ReConnect(); } if (LastRecLong > 2) { IODeviceInfo IOInfo = new IODeviceInfo(); IOInfo.ID = this.DeviceID; DelegateState.InvokeDispatchStateEvent(this.DeviceID.ToString() + "号IO设备掉线,重新尝试连接..."); //通知调度程序 小车已经掉线 IOInfo.bIsCommBreak = true; DelegateState.InvokeIOFeedBackEvent(IOInfo); } } catch (Exception ex) { DelegateState.InvokeDispatchStateEvent(this.DeviceID.ToString() + "号IO设备,观察线程异常"); LogHelper.WriteErrorLog(ex); } finally { if (!IsStop) { communicationobserve_timer.Enabled = true; } } }
public static Function[] GetFunctions(DeviceID id) { List <Function> retValue = new List <Function>(); switch (id) { case DeviceID.CPAR: retValue.Add(functions[typeof(DeviceIdentification)]); retValue.Add(functions[typeof(SetWaveformProgram)]); retValue.Add(functions[typeof(StartStimulation)]); retValue.Add(functions[typeof(StopStimulation)]); retValue.Add(functions[typeof(WriteSerialNumber)]); retValue.Add(functions[typeof(WriteCalibration)]); retValue.Add(functions[typeof(ReadCalibration)]); retValue.Add(functions[typeof(KickWatchdog)]); retValue.Add(functions[typeof(ResetDevice)]); retValue.Add(functions[typeof(ForceStartStimulation)]); break; case DeviceID.HW_TESTER: retValue.Add(functions[typeof(DeviceIdentification)]); retValue.Add(functions[typeof(WriteSerialNumber)]); retValue.Add(functions[typeof(WriteCalibration)]); retValue.Add(functions[typeof(ReadCalibration)]); retValue.Add(functions[typeof(SetDigitalPin)]); retValue.Add(functions[typeof(SetAnalogVoltage)]); retValue.Add(functions[typeof(ReadHalStatus)]); break; default: break; } return(retValue.ToArray()); }
void ReleaseDesignerOutlets() { if (DeviceID != null) { DeviceID.Dispose(); DeviceID = null; } if (DismissKeyboardTapGesture != null) { DismissKeyboardTapGesture.Dispose(); DismissKeyboardTapGesture = null; } if (MomentIdField != null) { MomentIdField.Dispose(); MomentIdField = null; } if (MomentValueField != null) { MomentValueField.Dispose(); MomentValueField = null; } if (SaveMomentButton != null) { SaveMomentButton.Dispose(); SaveMomentButton = null; } }
public InfoSendToATP(TrainInfo trainInfo, DeviceID senderID) { atpPackage = new ATPPackage(); this.trainInfo = trainInfo; this.senderID = senderID; SetInfoToVOBC(); }
void CreateHeepDevice() { List <byte> ID = new List <byte>(); for (byte i = 0; i < 4; i++) { ID.Add(i); } DeviceID myID = new DeviceID(ID); myDevice = new HeepDevice(myID); myDevice.LoadDeviceMemoryFromFile(); Control theControl = Control.CreateControl(Control.CtrlInputOutput.input, Control.CtrlType.OnOff, "First", sendAnalytics); myDevice.AddControl(theControl); Control newControl = Control.CreateControl(Control.CtrlInputOutput.output, Control.CtrlType.OnOff, "Second", sendAnalytics); myDevice.AddControl(newControl); Control bufferControl = new BufferControl(0, Control.CtrlInputOutput.output, Control.CtrlType.buffer, 10, 0, 0, "Buffer", true); myDevice.AddControl(bufferControl); myDevice.SetDeviceNameStartup("Unity"); myDevice.StartListening(); }
public MakeCall NewMakeCall(DeviceID callingDevice, DeviceID calledDirectoryNumber) { return(new MakeCall { callingDevice = callingDevice, calledDirectoryNumber = calledDirectoryNumber }); }
void GetPhysicalAddress() { #if UNITY_EDITOR physicalAddress = "test"; #else physicalAddress = DeviceID.Get(); #endif }
public MainForm() { //CreateTemplateXML(); long readInDeviceID = 0; string deviceName = ""; XmlTextReader textReader = new XmlTextReader("TrackerSettings.xml"); while (textReader.Read()) { switch (textReader.NodeType) { case XmlNodeType.Element: // The node is an element. if (textReader.Name == "Name") { textReader.Read(); deviceName = textReader.Value; } else if (textReader.Name == "SamplePeriod") { textReader.Read(); allowableDownTime = Double.Parse(textReader.Value); } else if (textReader.Name == "DeviceID") { textReader.Read(); readInDeviceID = long.Parse(textReader.Value); } Console.Write("<" + textReader.Name); Console.WriteLine(">"); break; } } List <byte> ID = new List <byte>(); for (byte i = 0; i < 4; i++) { ID.Add((byte)(readInDeviceID >> 3 * 8 - i * 8 & 0xFF)); } DeviceID myID = new DeviceID(ID); myDevice = new HeepDevice(myID); myDevice.AddControl(Heep.Control.CreateControl(Heep.Control.CtrlInputOutput.input, Heep.Control.CtrlType.OnOff, "Key Up", true)); myDevice.SetDeviceNameStartup(deviceName); myDevice.StartListening(); InitializeComponent(); System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 5000; aTimer.Enabled = true; }
private string getDeviceID() { if (deviceID == "") { deviceID = StringUtil.Base64Encode(DeviceID.Get()); } Debug.Log("deviceId:" + deviceID); return(deviceID); }
private void CalibrateTrigger_Click(object sender, RoutedEventArgs e) { _calibrationTarget = (sender as FrameworkElement).Tag.ToString(); var nonCalibrated = new NintrollerLib.Trigger(); var curCalibrated = new NintrollerLib.Trigger(); if (_calibrationTarget == App.CAL_CC_RTRIGGER) { nonCalibrated = Calibrations.None.ClassicControllerRaw.R; curCalibrated = ((ClassicController)_lastState).R; } else if (_calibrationTarget == App.CAL_CC_LTRIGGER) { nonCalibrated = Calibrations.None.ClassicControllerRaw.L; curCalibrated = ((ClassicController)_lastState).L; } else if (_calibrationTarget == App.CAL_GUT_WHAMMY) { nonCalibrated = Calibrations.None.GuitarRaw.whammyBar; curCalibrated = ((Guitar)_lastState).whammyBar; } else { return; } Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated); _openTrigWindow = trigCal; #if DEBUG if (DeviceID.StartsWith("Dummy")) { trigCal.Closed += (obj, args) => { if (trigCal.Apply) { OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName); } _openTrigWindow = null; }; trigCal.Show(); return; } #endif trigCal.ShowDialog(); if (trigCal.Apply) { OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName); } _openTrigWindow = null; }
public void WriteCIHead(DeviceID SenderID) { PacketHeader head = new PacketHeader(); CIPacket.PackUint16(0); CIPacket.PackUint16((UInt16)DataType.ZCToCI); CIPacket.PackByte((byte)DeviceID.ZC); CIPacket.PackByte((byte)SenderID); CIPacket.PackUint16(0); }
public override int GetHashCode() { return ((Name != null ? Name.GetHashCode() : 0) + (DeviceID != null ? DeviceID.GetHashCode() : 0) + (WiFi != null ? WiFi.GetHashCode() : 0) + (MQTT != null ? MQTT.GetHashCode() : 0) + (OTA != null ? OTA.GetHashCode() : 0) + (Settings != null ? Settings.Select(item => (item.Key.GetHashCode() + item.Value.GetHashCode()).GetHashCode()).Sum(item => (long)item).GetHashCode() : 0)); }
public MonitorStart NewMonitorStartRequest(DeviceID deviceId, bool callViaDevice = false) { if (callViaDevice) { return(NewMonitorStartRequest_CallViaDevice(deviceId)); } else { return(NewMonitorStartRequest_Standard(deviceId)); } }
private static void SafeToProceed(DeviceID id) { if (id == DeviceInfo.GetDeviceID()) { return; } else { throw new NotSupportedException(); } }
private void connectToELLStageButton_Click(object sender, EventArgs e) { var args = new string[] { comPortComboBox1.SelectedItem.ToString(), "0" }; // get the communication portELLStage portELLStage = (args.Length > 0) ? args[0] : comPortComboBox1.SelectedItem.ToString(); // get the range of addresses used max range is '0' to 'F' char _minSearchLimit = (args.Length > 1 && ELLBaseDevice.IsValidAddress(char.ToUpper(args[1][0]))) ? char.ToUpper(args[1][0]) : '0'; char _maxSearchLimit = (args.Length > 2 && ELLBaseDevice.IsValidAddress(char.ToUpper(args[2][0]))) ? char.ToUpper(args[2][0]) : '1'; if (ELLDevicePort.Connect(portELLStage)) { textBox1.Text = "Discover devices"; // scan the portELLStage for connected devices using the given range of addresses List <string> devices = ellDevices.ScanAddresses(_minSearchLimit, _maxSearchLimit); foreach (string device in devices) { // configure each device found if (ellDevices.Configure(device)) { // test each device found textBox1.Text = "Identify device " + device[0]; textBox1.Text = "+++++++++++++++++++++++++"; addressedDevice = ellDevices.AddressedDevice(device[0]) as ELLDevice; if (addressedDevice != null) { DeviceID deviceInfo = addressedDevice.DeviceInfo; string sttr = ""; foreach (string str in deviceInfo.Description()) { sttr += str + Environment.NewLine; } textBox1.Text = sttr; switch (deviceInfo.DeviceType) { case DeviceID.DeviceTypes.OpticsRotator: //addressedDevice.SetHomeOffset((decimal)0.0); addressedDevice.Home(ELLBaseDevice.DeviceDirection.AntiClockwise); Thread.Sleep(250); homeOffset = addressedDevice.HomeOffset; break; default: break; } } } } } }
private void SetupFunctions(DeviceID id) { mFunctionList.Items.Clear(); mFunctionList.Items.AddRange(FunctionFactory.GetFunctions(id)); if (mFunctionList.Items.Count > 0) { mFunctionList.SelectedIndex = 0; mPropertyGrid.SelectedObject = mFunctionList.SelectedItem; } }
public I2CConfiguration(ONIDeviceAddress address, DeviceID id, uint i2cAddress) { Valid = ONIXDeviceDescriptor.IsValid(id, address); context = ONIContextManager.ReserveContext(address.HardwareSlot); deviceAddress = address.Address; I2CAddress = i2cAddress; #if DEBUG Console.WriteLine("I2C context reserved by " + this.GetType()); #endif }
public DeviceInfo() { m_device_id = new DeviceID(-1, string.Empty); type = DeviceType.Unknown; ipAddress = "0.0.0.0"; username = password = string.Empty; deleted = false; collectors = new List <CollectorInfo>(); driveNames = new Dictionary <string, string>(); monitoredDrives = new MonitoredDriveManager(); groupID = -1; }
public DeviceInfo(DeviceType type) { m_device_id = new DeviceID(-1, string.Empty); this.type = type; ipAddress = "0.0.0.0"; username = password = string.Empty; deleted = false; collectors = CollectorInfo.FromCollectorTypes(type.GetCollectors()); driveNames = new Dictionary <string, string>(); monitoredDrives = new MonitoredDriveManager(); groupID = -1; }
/// <summary> /// Get device. /// </summary> /// <param name="aVendorID">A vendor ID.</param> /// <param name="aDeviceID">A device ID.</param> /// <returns></returns> public static PCIDevice GetDevice(VendorID aVendorID, DeviceID aDeviceID) { foreach (var xDevice in Devices) { if ((VendorID)xDevice.VendorID == aVendorID && (DeviceID)xDevice.DeviceID == aDeviceID) { return(xDevice); } } return(null); }
private CollectorInfo() { CID = new CollectorID(-1, string.Empty); DID = new DeviceID(-1, string.Empty); collectorType = CollectorType.Unknown; isEnabled = true; frequencyInMinutes = collectorType.GetFrequencyInMinutes(); SkipConfiguration = collectorType.GetSkipConfiguration(); lastCollectionAttempt = lastCollectedAt = nextCollectionTime = null; successfullyCollected = true; isBeingCollected = false; }
public static bool Insert(LogTypes logTypes, DeviceID deviceID, StatusType statusType, string data) { SqlCommand comand = new SqlCommand("insert into Report (DeviceID,Data,LogTypeID,Time,StatusID) values (@deviceid,@data,@logtypeid,@time,@statusid)", SqlTools.Connection); comand.Parameters.AddWithValue("@deviceid", deviceID); comand.Parameters.AddWithValue("@data", data); comand.Parameters.AddWithValue("@logtypeid", logTypes); comand.Parameters.AddWithValue("@time", DateTime.Now); comand.Parameters.AddWithValue("@statusid", statusType); return(SqlTools.ExecuteNonQuery(comand)); }
private void CalibrateTrigger(bool rightTrigger) { GameCubeController controller; GetActivePort(out controller); var nonCalibrated = new NintrollerLib.Trigger(); var curCalibrated = new NintrollerLib.Trigger(); if (rightTrigger) { _calibrationTarget = "R"; nonCalibrated = Calibrations.None.GameCubeControllerRaw.R; curCalibrated = controller.R; } else { _calibrationTarget = "L"; nonCalibrated = Calibrations.None.GameCubeControllerRaw.L; curCalibrated = controller.L; } Windows.TriggerCalibrationWindow trigCal = new Windows.TriggerCalibrationWindow(nonCalibrated, curCalibrated); _openTrigWindow = trigCal; #if DEBUG // Don't use show dialog so dummy values can be modified if (DeviceID?.StartsWith("Dummy") ?? false) { trigCal.Closed += (obj, args) => { if (trigCal.Apply) { OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName); } _openTrigWindow = null; }; trigCal.Show(); return; } #endif trigCal.ShowDialog(); if (trigCal.Apply) { OnTriggerCalibrated?.Invoke(trigCal.Calibration, _calibrationTarget, trigCal.FileName); } _openTrigWindow = null; trigCal = null; }
private void CalibrateJoystick(bool cStick) { GameCubeController controller; GetActivePort(out controller); var nonCalibrated = new NintrollerLib.Joystick(); var curCalibrated = new NintrollerLib.Joystick(); if (cStick) { _calibrationTarget = "cStk"; nonCalibrated = Calibrations.None.GameCubeControllerRaw.cStick; curCalibrated = controller.cStick; } else { _calibrationTarget = "joy"; nonCalibrated = Calibrations.None.GameCubeControllerRaw.joystick; curCalibrated = controller.joystick; } Windows.JoyCalibrationWindow joyCal = new Windows.JoyCalibrationWindow(nonCalibrated, curCalibrated); _openJoyWindow = joyCal; #if DEBUG // Don't use show dialog so dummy values can be modified if (DeviceID?.StartsWith("Dummy") ?? false) { joyCal.Closed += (obj, args) => { if (joyCal.Apply) { OnJoyCalibrated?.Invoke(joyCal.Calibration, _calibrationTarget, joyCal.FileName); } _openJoyWindow = null; }; joyCal.Show(); return; } #endif joyCal.ShowDialog(); if (joyCal.Apply) { OnJoyCalibrated?.Invoke(joyCal.Calibration, _calibrationTarget, joyCal.FileName); } _openJoyWindow = null; joyCal = null; }
public TestEnumerable SetMotherBoard(DeviceID id) { var packet = new DevicePacket() { ID = id, ModuleType = ModuleTypeEnum.MotherBoard, }; var state = PicDeviceFactoryProvider.MotherBoardFactory.DeviceStateCreate(); state.BasePacket = packet; state.Data.ModuleType [0] = 0x10; //mb, sens return setStack(() => new [] { state }); }
public TestEnumerable SetTrainSensors(DeviceID id) { var tsenses = Enumerable.Range(0, 256) .Select((i) => new TrainSensorState() { BasePacket = new DevicePacket() { ID = id, ModuleType = ModuleTypeEnum.TrainSensor, }, Mode = TrainSensorMode.meisuring, ReferenceVoltageMinus = 0.0F, ReferenceVoltagePlus = 5.0F, VoltageResolution = 10, ThresholdVoltageLower = 2.0F, CurrentVoltage = (float)(5.0 * (double)i / 256.0), Timer = (ushort)(i * 256), }); return setStack(() => tsenses); }
public TestEnumerable SetTrainDetectingSensor(DeviceID id) { var tsens = Enumerable.Range(0, 256) .Select((i) => new TrainSensorState() { BasePacket = new DevicePacket() { ID = id, ModuleType = ModuleTypeEnum.TrainSensor, }, Mode = TrainSensorMode.detecting, ReferenceVoltageMinus = 0.0f, ReferenceVoltagePlus = 5.0f, VoltageResolution = 10, ThresholdVoltageLower = 2.5F, ThresholdVoltageHigher = 4.0f, CurrentVoltage = i * 2.5f, Timer = (ushort)(i * 1000), IsDetected = i == 0, }); return setStack(() => tsens); }
public TestEnumerable SetController(DeviceID id) { var data = new TrainControllerData(); data.mode = TrainControllerMode.Duty; data.duty = 0; data.direction = TrainControllerDirection.Positive; data.paramp = 0xcc; data.parami = 0x11; var stat = new TrainControllerState() { BasePacket = new DevicePacket() { ID = id, ModuleType = ModuleTypeEnum.TrainController }, Data = data, }; return setStack(() => new [] { stat }); }
private byte[] SendCommand(byte nOfParameters, DeviceID deviceId, DeviceCommands command, byte[] par) { switch (deviceId) { case DeviceID.DecAltMotor: case DeviceID.RaAzmMotor: return this.MotorCommands(nOfParameters, command, par); case DeviceID.HC: default: return "#".ToBytes(); } }
String Command.execute(string instruction) { string deviceID; DeviceID dID = null; try { dID = new DeviceID(); } catch( Exception ex ) { } deviceID = dID.ToString(); if( deviceID.Length == 0 ) { deviceID = ""; } string retVal = ";device.platform = '" + OSInfo.GetPlatform() + "';"; retVal += "device.version = '" + OSInfo.GetVersion() + "';"; retVal += "device.name = '" + PInvoke.GetOemInfo() + "';"; retVal += "device.gap = '" + version + "';"; retVal += "device.uuid = '" + deviceID + "';"; retVal += "deviceInfo();"; return retVal; }
public TestEnumerable SetPointModules(DeviceID id) { var data = new PointModuleData(); for (int i = 0; i < data.Directions.Length; i += 2) data.Directions [i] = 1; var state = new PointModuleState() { BasePacket = new DevicePacket() { ID = id, ModuleType = ModuleTypeEnum.PointModule }, Data = data, }; return setStack(() => new [] { state }); }
private SfRserver GetServer(string serverName, string farm, SessionToken token, IEnumerable<DeviceID> deviceIds, out DeviceID deviceId) { deviceId = null; foreach (var currentDeviceId in deviceIds) { try { var rServerRequest = new listServerfarmRservers { deviceID = currentDeviceId, serverfarmname = farm, sessionToken = token }; var rServers = _proxy.listServerfarmRservers(new listServerfarmRserversRequest { listServerfarmRservers = rServerRequest }); var sfRServer = rServers.listServerfarmRserversResponse.SfRservers.Single(x => x.realserverName.ToLower() == serverName.ToLower()); deviceId = currentDeviceId; return sfRServer; } catch(FaultException<WSException> aceEx) { Logger.Verbose("Web Service Fault: {0}", aceEx.Message); Logger.Verbose("Since this device [{0}] faulted, ConDep will try next device.", currentDeviceId.name); } } throw new ConDepLoadBalancerException("Unable to get real server from load balancer. Use verbose logging for more details."); }
private static void SafeToProceed(DeviceID id) { if (id == DeviceInfo.GetDeviceID()) return; else throw new NotSupportedException(); }
private SfRserver GetServer(string serverName, string farm, SessionToken token, DeviceID deviceId) { var rServerRequest = new listServerfarmRservers {deviceID = deviceId, serverfarmname = farm, sessionToken = token}; var rServers = _proxy.listServerfarmRservers(new listServerfarmRserversRequest { listServerfarmRservers = rServerRequest}); var sfRServer = rServers.listServerfarmRserversResponse.SfRservers.Single(x => x.realserverName.ToLower() == serverName.ToLower()); return sfRServer; }
public override bool IsSlewDone(DeviceID deviceId) { var res = this.SendCommandToDevice(deviceId, DeviceCommands.MC_SLEW_DONE, 1); return res[0] != 0; }
public override double GetDeviceVersion(DeviceID device) { // var com = new byte[] { (byte)'P', 1, (byte)device, 254, 0, 0, 0, 2 }; var ans = this.SendCommandToDevice(device, DeviceCommands.GET_VER, 2); // var res = SendBytes(com); var low = (double)ans[1]; low = low / (low < 10 ? 10 : low < 100 ? 100 : 1000); return ans[0] + low; }