/// <summary> /// 点击某一项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucs_Click(object sender, EventArgs e) { UCDevicesState uc = (UCDevicesState)sender; MouseEventArgs args = (MouseEventArgs)e; IDevices dev = (IDevices)uc.Tag; if (selectedUCDev != null) { selectedUCDev.Select(false); } uc.Select(true); SelectedUCDev = uc; this.Device = dev; if (args.Button == MouseButtons.Right) { contextMenuStrip1.Show(uc.PointToScreen(args.Location)); } else { if (IsSelectedCloseFrom) { this.DialogResult = DialogResult.OK; } } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Device> GetDeviceAsync(this IDevices operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDeviceWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public DevicesTest() { this.registryMock = new Mock <RegistryManager>(); this.mockTenantHelper = new Mock <ITenantConnectionHelper>(); this.mockTenantHelper.Setup(e => e.GetIotHubName()).Returns(this.ioTHubHostName); this.mockTenantHelper.Setup(e => e.GetRegistry()).Returns(this.registryMock.Object); MockIdentity.MockClaims("one"); this.mockAsaManager = new Mock <IAsaManagerClient>(); this.mockAsaManager .Setup(x => x.BeginDeviceGroupsConversionAsync()) .ReturnsAsync(new BeginConversionApiModel()); this.mockCache = new Mock <IDeviceQueryCache>(); this.mockCache .Setup(x => x.GetCachedQueryResultAsync(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync((DeviceServiceListModel)null); this.mockCache .Setup( x => x.SetTenantQueryResult( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DeviceQueryCacheResultServiceModel>())); this.devices = new Devices(this.mockTenantHelper.Object, this.ioTHubHostName, this.mockAsaManager.Object, this.mockCache.Object); }
/// <summary> /// Returns the device details. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='deviceUdid'> /// The UDID of the device /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> DeviceDetailsAsync(this IDevices operations, string deviceUdid, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeviceDetailsWithHttpMessagesAsync(deviceUdid, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// **Warning, this operation is not reversible.** /// /// A successful call to this API will permanently stop ingesting any logs /// received via SDK for the given installation ID, and cannot be restored. We /// advise caution when using this API, it is designed to permanently disable /// collection from a specific installation of the app on a device, usually /// following the request from a user. /// /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='installId'> /// The id of the device /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <string> BlockLogsAsync(this IDevices operations, string installId, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BlockLogsWithHttpMessagesAsync(installId, ownerName, appName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Registers a user for an existing device /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='userId'> /// The ID of the user /// </param> /// <param name='body'> /// The device info. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> RegisterUserForDeviceAsync(this IDevices operations, string userId, DeviceInfoRequest body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RegisterUserForDeviceWithHttpMessagesAsync(userId, body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Returns all devices associated with the given distribution group /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='distributionGroupName'> /// The name of the distribution group. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='releaseId'> /// when provided, gets the provisioning state of the devices owned by users of /// this distribution group when compared to the provided release. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> ListAsync(this IDevices operations, string distributionGroupName, string ownerName, string appName, double?releaseId = default(double?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(distributionGroupName, ownerName, appName, releaseId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Returns all devices associated with the given distribution group. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='distributionGroupName'> /// The name of the distribution group. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='unprovisionedOnly'> /// when true, filters out provisioned devices /// </param> /// <param name='udids'> /// multiple UDIDs which should be part of the resulting CSV. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ErrorDetails> ListCsvFormatAsync(this IDevices operations, string distributionGroupName, string ownerName, string appName, bool?unprovisionedOnly = false, IList <string> udids = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListCsvFormatWithHttpMessagesAsync(distributionGroupName, ownerName, appName, unprovisionedOnly, udids, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Returns the resign status to the caller /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='releaseId'> /// The ID of the release. /// </param> /// <param name='resignId'> /// The ID of the resign operation. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='includeProvisioningProfile'> /// A boolean value that indicates if the provisioning profile should be return /// in addition to the status. When set to true, the provisioning profile will /// be returned only when status is 'complete' or 'preparing_for_testers'. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetReleaseUpdateDevicesStatusAsync(this IDevices operations, string releaseId, string resignId, string ownerName, string appName, bool?includeProvisioningProfile = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetReleaseUpdateDevicesStatusWithHttpMessagesAsync(releaseId, resignId, ownerName, appName, includeProvisioningProfile, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public void Init(IDevices dirnx700) { nx700 = (DRI_CHEM_NX700iVC)dirnx700; log = new Log(nx700.Info.Name); nx700config = (DRI_CHEM_NX700iVCConfig)nx700.Config; buffer = new List <byte>(); }
public void Init(IDevices diridexx) { LockObj = "lock"; idexx = (IDEXX_VetLab_Station)diridexx; log = new Log(idexx.Info.Name); idexxConfig = (IDEXX_VetLab_StationConfig)idexx.Config; }
public SimulationRunner( IRateLimitingConfig ratingConfig, IRateLimiting rateLimiting, ISimulationConcurrencyConfig simulationConcurrencyConfig, ILogger logger, IDiagnosticsLogger diagnosticsLogger, IDeviceModels deviceModels, IDeviceModelsGeneration deviceModelsOverriding, IDevices devices, ISimulations simulations, IFactory factory) { this.connectionLoopSettings = new ConnectionLoopSettings(ratingConfig); this.propertiesLoopSettings = new PropertiesLoopSettings(ratingConfig); this.simulationConcurrencyConfig = simulationConcurrencyConfig; this.log = logger; this.diagnosticsLogger = diagnosticsLogger; this.deviceModels = deviceModels; this.deviceModelsOverriding = deviceModelsOverriding; this.devices = devices; this.simulations = simulations; this.factory = factory; this.startLock = new { }; this.running = false; this.starting = false; this.rateLimiting = rateLimiting; this.deviceStateActors = new ConcurrentDictionary <string, IDeviceStateActor>(); this.deviceConnectionActors = new ConcurrentDictionary <string, IDeviceConnectionActor>(); this.deviceTelemetryActors = new ConcurrentDictionary <string, IDeviceTelemetryActor>(); this.devicePropertiesActors = new ConcurrentDictionary <string, IDevicePropertiesActor>(); }
public MainPageViewModel(INavigationService navigationService, IDevices devices) { _navigationService = navigationService; _devices = devices; DeviceID = _devices.GetID(); }
private static string Volume(string action, IDevices devices) { var device = GetDevice(devices, action); if (device == null) { return(errorDeviceNotFound); } var deviceVolume = action.Split('/')?.Length > 2 ? action.Split('/')[2] : null; if (string.IsNullOrEmpty(deviceVolume)) { return(errorWrongVolume); } if (!int.TryParse(deviceVolume, out int level)) { return(errorWrongVolume); } if (level < 0 || level > 100) { return(errorWrongVolume); } device.VolumeSet(level / 100.0f); var response = "{\"data\": { \"type\": \"done\", \"id\": \"1\", \"attributes\": { \"action\": \"/volume" + action + "\" } } }"; return(response); }
public async Task <bool> TryToStartDevicesCreationAsync(string simulationId, IDevices devices) { // Fetch latest record var simulation = await this.GetAsync(simulationId); // Edit the record only if required if (!simulation.DevicesCreationStarted) { try { Dictionary <string, List <string> > deviceList = this.GetDeviceIdsByModel(simulation); var deviceIds = deviceList.SelectMany(x => x.Value); this.log.Info("Creating devices...", () => new { simulationId }); simulation.DeviceCreationJobId = await devices.CreateListUsingJobsAsync(deviceIds); simulation.DevicesCreationStarted = true; this.log.Info("Device import job created", () => new { simulationId, simulation.DeviceCreationJobId }); await this.SaveAsync(simulation, simulation.ETag); } catch (Exception e) { this.log.Error("Failed to create device import job", e); return(false); } } return(true); }
private static string Start(string action, IDevices devices) { if (string.IsNullOrEmpty(action.Replace("/", ""))) { var deviceList = devices.GetDeviceList(); foreach (var device in deviceList) { device.ResumePlaying(); } } else { var device = GetDevice(devices, action); if (device == null) { return(errorDeviceNotFound); } device.ResumePlaying(); } var response = "{\"data\": { \"type\": \"done\", \"id\": \"1\", \"attributes\": { \"action\": \"/start" + action + "\" } } }"; return(response); }
public Deployments( AppConfig config, ILogger <Deployments> logger, IDeploymentEventLog deploymentLog, ITenantConnectionHelper tenantConnectionHelper, IConfigClient packagesConfigClient, IStorageAdapterClient client, IDevices devices, IStorageClient storageClient, IAppConfigurationClient appConfigurationClient) { if (config == null) { throw new ArgumentNullException("config"); } this.tenantHelper = tenantConnectionHelper; this.deploymentLog = deploymentLog; this.logger = logger; this.configClient = packagesConfigClient; this.client = client; this.devices = devices; this.config = config; this.storageClient = storageClient; this.appConfigurationClient = appConfigurationClient; }
/// <summary> /// Returns all devices associated with the given user. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> UserDevicesListAsync(this IDevices operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UserDevicesListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public DeviceMonitor( [NotNull] ILogger logger, [NotNull] IScheduler scheduler, [NotNull] Func <ISubject <IDevice> > factory, [NotNull] IDevices devices, [NotNull] IWatcher watcher) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(factory, nameof(factory)); Guard.ArgumentNotNull(devices, nameof(devices)); Guard.ArgumentNotNull(watcher, nameof(watcher)); Guard.ArgumentNotNull(scheduler, nameof(scheduler)); _logger = logger; _scheduler = scheduler; _devices = devices; _watcher = watcher; _deviceUpdated = factory.Invoke( ); _deviceDiscovered = factory.Invoke( ); _deviceNameUpdated = factory.Invoke( ); }
private static IDevice GetDevice(IDevices devices, string action) { if (action.IndexOf("/") != 0) { return(null); } var deviceName = action.Split('/')?.Length > 0 ? action.Split('/')[1] : null; if (string.IsNullOrEmpty(deviceName)) { return(null); } var deviceList = devices.GetDeviceList(); foreach (var device in deviceList) { if (device.GetFriendlyName().ToLowerInvariant() == deviceName) { return(device); } } return(null); }
public UCQueue(IDevices dev) { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; this.Dock = DockStyle.Fill; _dev = dev; }
public void Initialize() { _scheduler = new TestScheduler(); _logger = Substitute.For <ILogger>(); _device = Substitute.For <IDevice>(); _device.Name .Returns((string)null); _deviceNewName = Substitute.For <IDevice>(); _deviceNewName.Name .Returns("New Name"); _deviceOtherNewName = Substitute.For <IDevice>(); _deviceOtherNewName.Name .Returns("Other New Name"); _factory = Factory; _subjectStarted = new Subject <IDevice>(); _subjectStopped = new Subject <IDevice>(); _subjectUpdated = new Subject <IDevice>(); _devices = new Devices(_logger); _watcher = Substitute.For <IWatcher>(); _subjects = new Queue <ISubject <IDevice> >(); _subjects.Enqueue(_subjectStarted); _subjects.Enqueue(_subjectStopped); _subjects.Enqueue(_subjectUpdated); }
private void 设置ToolStripMenuItem_Click(object sender, EventArgs e) { if (selectedUCDev != null) { IDevices dev = (IDevices)selectedUCDev.Tag; dev.ShowConfigForm(); } }
public Agent(IDevices devices, IServicesConfig config) { this._devices = devices; this._config = config; var system = ActorSystem.Create("sensewire"); _deviceManager = system.ActorOf(Props.Create <DeviceManager>(), "device-manager"); }
private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e) { if (selectedUCDev != null) { IDevices dev = (IDevices)selectedUCDev.Tag; dev.Close(); } }
public void Init(IDevices info) { timer = new Timer(10000); timer.Elapsed += Timer_Elapsed; abaxisDevice = (Abaxis_Fuse)info; log = new Log(abaxisDevice.Info.Name); fuseConfig = (FuseConfig)abaxisDevice.Config; }
private async Task <DeviceServiceListModel> GetDeviceListAsync(string deploymentId, List <string> deviceIds, string tenantId) { string query = string.Empty; int iotHublimit = 500; string deviceListValue = string.Empty; var deploymentDeviceTask = this.GetDeploymentDevicesAsync(deploymentId, tenantId); DeviceServiceListModel allDevices = new DeviceServiceListModel(new List <DeviceServiceModel>(), null); if (deviceIds?.Count > 0) { for (int i = 0; i < (deviceIds.Count / iotHublimit) + 1; i++) { if (i != 0 && (deviceIds.Count % (i * iotHublimit)) <= 0) { break; } List <string> batchDeviceIds = deviceIds.Skip(i * iotHublimit).Take(iotHublimit).ToList(); if (batchDeviceIds != null && batchDeviceIds.Count > 0) { deviceListValue = string.Join(",", batchDeviceIds.Select(p => $"'{p}'")); } query = $" deviceId IN [{deviceListValue}]"; var devices = await this.devices.GetListFromIoTHubAsync(query, null); allDevices.Items.AddRange(devices.Items); while (!string.IsNullOrWhiteSpace(devices.ContinuationToken)) { devices = await this.devices.GetListFromIoTHubAsync(query, null); allDevices.Items.AddRange(devices.Items); } } var deploymentDeviceHistory = await deploymentDeviceTask; if (deploymentDeviceHistory != null && deploymentDeviceHistory.Items.Count > 0) { Parallel.ForEach(allDevices.Items, item => { var twin = deploymentDeviceHistory.Items.FirstOrDefault(i => i.DeviceId == item.Id)?.Twin; if (twin != null) { item.Twin = twin; } item.PreviousTwin = deploymentDeviceHistory.Items.FirstOrDefault(i => i.DeviceId == item.Id)?.PreviousFirmwareTwin; }); } } return(allDevices); }
public AddComputer(IDevices device) { InitializeComponent(); DataContext = device; if (device.GetType() == typeof(ViewModel.ComputerViewModel)) { MessageBox.Show("Huraa to komputer"); } }
public DevicesTest() { this.registryMock = new Mock <RegistryManager>(); this.tenantHelper = new Mock <ITenantConnectionHelper>(); this.tenantHelper.Setup(e => e.GetIotHubName()).Returns(this.ioTHubHostName); this.tenantHelper.Setup(e => e.GetRegistry()).Returns(this.registryMock.Object); MockIdentity.MockClaims("one"); this.devices = new Devices(this.tenantHelper.Object, this.ioTHubHostName); }
public Connect( IDevices devices, IScriptInterpreter scriptInterpreter, ILogger logger) { this.log = logger; this.scriptInterpreter = scriptInterpreter; this.devices = devices; }
/// <summary> /// Runs the telemetry network. The boot-up code is called via ThreadPool /// </summary> public void Run() { Peripherals = new Devices(); ThreadPool.QueueUserWorkItem(new WaitCallback(Bootup)); }
/// <summary> /// Runs the telemetry network. The boot-up code is called via ThreadPool /// </summary> public void Run() { Peripherals = new Devices(); Bootup(string.Empty); }