Example #1
0
 public string Post(DeviceDetails device)
 {
     try
     {
         string    query = @"insert into dbo.Devices values(
                                                         
                                                         '" + device.Name + @"'
                                                         ,'" + device.OsType + @"'
                                                         ," + device.Battery + @"
                                                         ,'" + device.Memory + @"'
                                                         )
                                                         ";
         DataTable table = new DataTable();
         using (var con = new SqlConnection(ConfigurationManager.
                                            ConnectionStrings["DeviceDetailsDB"].ConnectionString))
             using (var cmd = new SqlCommand(query, con))
                 using (var da = new SqlDataAdapter(cmd))
                 {
                     cmd.CommandType = CommandType.Text;
                     da.Fill(table);
                 }
         return("Added Successfully");
     }
     catch (Exception)
     {
         return("Failed to Add");
     }
 }
        public void TestSettingNullsInPaymentRequestModel()
        {
            var urlDetails = new UrlDetails {
                BackUrl = null, FailureUrl = null, NotificationUrl = null, PendingUrl = null, SuccessUrl = null
            };
            var userDetails = new CashierUserDetails {
                FirstName = null, LastName = null, Address = null, City = null, Country = null, Email = null, County = null, DateOfBirth = null, Phone = null, State = null, Zip = null
            };
            var userAddress = new UserAddress {
                FirstName = null, LastName = null, Address = null, City = null, Country = null, Email = null, Cell = null, County = null, Phone = null, State = null, Zip = null
            };
            var browserDetails = new DeviceDetails {
                Browser = null, DeviceName = null, DeviceOS = null, DeviceType = null, IpAddress = null
            };
            var dynamicDescriptor = new DynamicDescriptor {
                MerchantName = null, MerchantPhone = null
            };

            _ = new PaymentRequest(merchantInfo, sessionToken, currency, amount, paymentOptionCard)
            {
                AmountDetails        = null,
                BillingAddress       = userAddress,
                CustomData           = null,
                CustomSiteName       = null,
                DeviceDetails        = browserDetails,
                DynamicDescriptor    = dynamicDescriptor,
                ProductId            = null,
                RelatedTransactionId = null,
                UrlDetails           = urlDetails,
                UserDetails          = userDetails,
                Items = null
            };

            Assert.Pass();
        }
Example #3
0
        public async Task <GetMerchantPaymentMethodsResponse> GetMerchantPaymentMethods(
            string clientRequestId,
            string currencyCode           = null,
            string countryCode            = null,
            string languageCode           = null,
            string type                   = null,
            string userId                 = null,
            DeviceDetails deviceDetails   = null,
            string rebillingType          = null,
            string authenticationTypeOnly = null,
            SubMerchant subMerchant       = null,
            Addendums addendums           = null)
        {
            var request = new GetMerchantPaymentMethodsRequest(
                merchantInfo,
                sessionToken,
                clientRequestId)
            {
                CurrencyCode           = currencyCode,
                CountryCode            = countryCode,
                LanguageCode           = languageCode,
                Type                   = type,
                UserId                 = userId,
                DeviceDetails          = deviceDetails,
                RebillingType          = rebillingType,
                AuthenticationTypeOnly = authenticationTypeOnly,
                SubMerchant            = subMerchant,
                Addendums              = addendums
            };

            return(await safechargeRequestExecutor.GetMerchantPaymentMethods(request));
        }
        public void CoreInfoEqualityTest()
        {
            var dateTimeOffset = DateTimeOffset.Now;

            var left = new DeviceDetails
            {
                DeviceId = "id",
                LastApp = "lastapp",
                LastHeard = dateTimeOffset,
                LastHandshake = dateTimeOffset,
                Connected = true
            };

            var right = new DeviceDetails
            {
                DeviceId = "id",
                LastApp = "lastapp",
                LastHeard = dateTimeOffset,
                LastHandshake = dateTimeOffset,
                Connected = true
            };

            Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
            Assert.AreEqual(left, right);
        }
Example #5
0
        public async Task <GetCardDetailsResponse> GetCardDetails(
            string clientUniqueId,
            string cardNumber,
            string userId = null,
            DeviceDetails deviceDetails   = null,
            string rebillingType          = null,
            string authenticationTypeOnly = null,
            SubMerchant subMerchant       = null,
            Addendums addendums           = null)
        {
            var request = new GetCardDetailsRequest(
                merchantInfo,
                sessionToken,
                clientUniqueId,
                cardNumber)
            {
                UserId                 = userId,
                DeviceDetails          = deviceDetails,
                RebillingType          = rebillingType,
                AuthenticationTypeOnly = authenticationTypeOnly,
                SubMerchant            = subMerchant,
                Addendums              = addendums
            };

            return(await safechargeRequestExecutor.GetCardDetails(request));
        }
    public void FindDevice(ulong code)
    {
        uint index = 0;

        try
        {
            index = Convert.ToUInt32(code);
        }
        catch (OverflowException)
        {
            Debug.LogErrorFormat("The {0} value {1} is outside the range of the Int32 type.",
                                 code.GetType().Name, code);
        }
        if (index == 0)
        {
            Debug.LogError("VuMark sample starts at 1");
            return;
        }
        DeviceDetails device = GetDevice(index - 1);

        if (device != null)
        {
            UpdateText("Found " + device.DeviceId);
        }
        else
        {
            UpdateText("Unknown device");
        }
    }
Example #7
0
            async Task executeScan()
            {
                if (isBusy)
                {
                    return;
                }

                isBusy = true;
                await ScanForDevices();

                var adapter = CrossBluetoothLE.Current.Adapter;
                var list    = deviceList;

                details.Clear();
                foreach (var l in list.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderBy(x => x.Name))
                {
                    var d = new DeviceDetails()
                    {
                        Name = l.Name, Gid = l.Id.ToString()
                    };
                    Console.WriteLine($"{d.Name} - {d.Gid}");
                    details.Add(d);
                }
                isBusy = false;
            }
Example #8
0
        public IMTSOutMessageEvent GetBatteryVoltageVia1939(DeviceDetails deviceDetails)
        {
            List <J1939ParameterID> periodicParameters      = new List <J1939ParameterID>();
            J1939ParameterID        batteryVoltageParameter = new J1939ParameterID();

            batteryVoltageParameter.PGN           = 65271;
            batteryVoltageParameter.SPN           = 168;
            batteryVoltageParameter.SourceAddress = 234;
            periodicParameters.Add(batteryVoltageParameter);

            J1939ParameterID kilowattHoursParameter = new J1939ParameterID();

            kilowattHoursParameter.PGN           = 65018;
            kilowattHoursParameter.SPN           = 2468;
            kilowattHoursParameter.SourceAddress = 234;
            periodicParameters.Add(kilowattHoursParameter);

            return(new SendJ1939PublicParametersRequest()
            {
                Context = new EventContext
                {
                    AssetUid = deviceDetails.AssetUid.ToString(),
                    DeviceId = deviceDetails.SerialNumber,
                    DeviceType = deviceDetails.DeviceType,
                    DeviceUid = deviceDetails.DeviceUid.ToString(),
                    EventUtc = DateTime.UtcNow,
                    MessageUid = Guid.NewGuid().ToString()
                },
                Parameters = periodicParameters
            });
        }
Example #9
0
        private DeviceDetails GetDeviceDetails(int deviceID)
        {
            Database      db      = new Database();
            DeviceDetails details = db.GetDeviceDetails(deviceID);

            return(details);
        }
        public IActionResult StatusUpdate(DeviceDetails details)
        {
            var output = new DeviceStatusUpdate();

            output.Device = details;
            try
            {
                if (details.LoanStatus == null)
                {
                    details.LoanStatus = "false";
                    details.LoanedTeam = "";
                }
                var data = JsonConvert.SerializeObject(details);
                var path = "./Data/" + details.OwnerTeam.Replace("+", " ") + "/" + details.DeviceName + ".txt";
                if (!System.IO.File.Exists(path))
                {
                    using (StreamWriter sw = System.IO.File.CreateText(path))
                    {
                        sw.WriteLine(data);
                    }
                }
                else
                {
                    System.IO.File.WriteAllText(path, data);
                }
                return(View(output));
            }
            catch
            {
                output.Error = "There was some error while updating the device status, please try again later.";
                return(View(output));
            }
        }
Example #11
0
        public IMTSOutMessageEvent GetPTOHoursviaJ1939(DeviceDetails deviceDetails)
        {
            List <J1939ParameterID> periodicParameters = new List <J1939ParameterID>();
            J1939ParameterID        engineTotalPTO     = new J1939ParameterID();

            engineTotalPTO.PGN           = 65255;
            engineTotalPTO.SPN           = 248;
            engineTotalPTO.SourceAddress = 0;
            periodicParameters.Add(engineTotalPTO);

            J1939ParameterID transmissionTotalPTO = new J1939ParameterID();

            transmissionTotalPTO.PGN           = 65255;
            transmissionTotalPTO.SPN           = 248;
            transmissionTotalPTO.SourceAddress = 3;
            periodicParameters.Add(transmissionTotalPTO);

            return(new SendJ1939PublicParametersRequest
            {
                Context = new VSS.VisionLink.Interfaces.Events.Commands.Models.EventContext
                {
                    AssetUid = deviceDetails.AssetUid.ToString(),
                    DeviceId = deviceDetails.SerialNumber,
                    DeviceType = deviceDetails.DeviceType,
                    DeviceUid = deviceDetails.DeviceUid.ToString(),
                    EventUtc = DateTime.UtcNow,
                    MessageUid = Guid.NewGuid().ToString()
                },
                Parameters = periodicParameters
            });
        }
Example #12
0
 public string Put(DeviceDetails device)
 {
     try
     {
         string    query = @"update dbo.Devices set
                          Name='" + device.Name + @"'
                          ,OsType='" + device.OsType + @"'
                          ,Battery=" + device.Battery + @"
                          ,Memory='" + device.Memory + @"'
                          where Id = " + device.Id + @"
                                                         ";
         DataTable table = new DataTable();
         using (var con = new SqlConnection(ConfigurationManager.
                                            ConnectionStrings["DeviceDetailsDB"].ConnectionString))
             using (var cmd = new SqlCommand(query, con))
                 using (var da = new SqlDataAdapter(cmd))
                 {
                     cmd.CommandType = CommandType.Text;
                     da.Fill(table);
                 }
         return("Updated Successfully");
     }
     catch (Exception)
     {
         return("Failed to Update");
     }
 }
        public async Task <DeviceDetails> GetAllDetailDeviceBySerialNumber(string serialNumber)
        {
            DeviceDetails row = null;
            await _connection.OpenAsync();

            try
            {
                using (MySqlCommand cmd = new MySqlCommand("Get_DeviceDetailBySerialNumber", _connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("SerialNumberVal", serialNumber);
                    var dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        row              = new DeviceDetails();
                        row.Id           = Convert.ToInt32(dr["deviceId"]);
                        row.Model        = dr["Model"].ToString();
                        row.Description  = dr["Description"].ToString();
                        row.SerialNumber = dr["SerialNumber"].ToString();
                        row.Version      = dr["Version"].ToString();
                        if (int.TryParse(dr["userId"].ToString(), out int userId))
                        {
                            row.UserId = userId;
                        }
                        row.UserName = dr["Username"].ToString();
                        if (int.TryParse(dr["InstituteId"].ToString(), out int InstituteId))
                        {
                            row.InstituteId = InstituteId;
                        }
                        row.InstituteName = dr["InstituteName"].ToString();
                        row.UserFullName  = dr["UserFullName"].ToString();
                        if (int.TryParse(dr["UserTypeId"].ToString(), out int UserTypeId))
                        {
                            row.UserTypeId = UserTypeId;
                        }
                        row.UserType             = dr["UserType"].ToString();
                        row.BucketName           = dr["BucketName"].ToString();
                        row.InstituteAccessKey   = dr["InstituteAccessKey"].ToString();
                        row.InstituteSecretKey   = dr["InstituteSecretKey"].ToString();
                        row.InstituteIamUserName = dr["InstituteIamUserName"].ToString();
                        row.BucketPath           = dr["BucketPath"].ToString();
                        row.UserAccessKey        = dr["UserAccessKey"].ToString();
                        row.UserSecretKey        = dr["UserSecretKey"].ToString();
                        row.UserIamUserName      = dr["UserIamUserName"].ToString();
                        //dt.Add(row);
                    }
                }

                return(row);
            }
            catch
            {
                throw;
            }
            finally
            {
                await _connection.CloseAsync();
            }
        }
Example #14
0
        /// <summary>
        /// Retrieves the capabilities of a waveIn device
        /// </summary>
        /// <param name="devNumber">Device to test</param>
        /// <returns>The WaveIn device capabilities</returns>
        public static DeviceDetails GetCapabilities(int devNumber)
        {
            var caps       = new DeviceDetails();
            int structSize = Marshal.SizeOf(caps);

            MmException.Try(WaveInterop.waveInGetDevCaps((IntPtr)devNumber, out caps, structSize), "waveInGetDevCaps");
            return(caps);
        }
Example #15
0
        public async Task <Authorize3dResponse> Authorize3d(
            string currency,
            string amount,
            PaymentOption paymentOption,
            string relatedTransactionId,
            List <Item> items                   = null,
            string userTokenId                  = null,
            string clientUniqueId               = null,
            string clientRequestId              = null,
            int?isRebilling                     = null,
            AmountDetails amountDetails         = null,
            DeviceDetails deviceDetails         = null,
            CashierUserDetails userDetails      = null,
            UserAddress shippingAddress         = null,
            UserAddress billingAddress          = null,
            DynamicDescriptor dynamicDescriptor = null,
            MerchantDetails merchantDetails     = null,
            Addendums addendums                 = null,
            UrlDetails urlDetails               = null,
            string customSiteName               = null,
            string productId                    = null,
            string customData                   = null,
            string transactionType              = null,
            bool autoPayment3D                  = default,
            string userId                 = null,
            string rebillingType          = null,
            string authenticationTypeOnly = null,
            SubMerchant subMerchant       = null)
        {
            var request = new Authorize3dRequest(merchantInfo, sessionToken, currency, amount, paymentOption, relatedTransactionId)
            {
                Items                  = items,
                UserTokenId            = userTokenId,
                ClientRequestId        = clientRequestId,
                ClientUniqueId         = clientUniqueId,
                IsRebilling            = isRebilling,
                AmountDetails          = amountDetails,
                DeviceDetails          = deviceDetails,
                UserDetails            = userDetails,
                ShippingAddress        = shippingAddress,
                BillingAddress         = billingAddress,
                DynamicDescriptor      = dynamicDescriptor,
                MerchantDetails        = merchantDetails,
                Addendums              = addendums,
                UrlDetails             = urlDetails,
                CustomSiteName         = customSiteName,
                ProductId              = productId,
                CustomData             = customData,
                TransactionType        = transactionType,
                AutoPayment3D          = autoPayment3D,
                UserId                 = userId,
                RebillingType          = rebillingType,
                AuthenticationTypeOnly = authenticationTypeOnly,
                SubMerchant            = subMerchant
            };

            return(await safechargeRequestExecutor.Authorize3d(request));
        }
 private static DeviceDetails[] GetAudioDevices(XAudio2 system)
 {
     DeviceDetails[] dd = new DeviceDetails[system.DeviceCount];
     for (int i = 0; i < dd.Length; i++)
     {
         dd[i] = system.GetDeviceDetails(i);
     }
     return(dd);
 }
Example #17
0
        public Guid GetUpdateRequestForDeviceType(DeviceDetails deviceDetails, string deviceTypeFamily, IDictionary <string, string> capabilitiesRecord, ref IList <DeviceACKMessage> deviceAckMessages, ref List <object> kafkaObjects)
        {
            kafkaObjects = new List <Object>(0);
            var messageUID = Guid.NewGuid();

            switch (deviceTypeFamily)
            {
            case "DataOut":
                kafkaObjects.AddRange(_deviceRequestStatusBuilder.BuildA5N2DeviceStatusUpdateRequestMessage(deviceDetails, capabilitiesRecord));
                foreach (var item in kafkaObjects.ToList())
                {
                    deviceAckMessages.Add(new DeviceACKMessage
                    {
                        AssetUID                = Guid.Parse((item as IOutMessageEvent).Context.AssetUid).ToString("N"),
                        DeviceUID               = Guid.Parse((item as IOutMessageEvent).Context.DeviceUid).ToString("N"),
                        DevicePingLogUID        = messageUID.ToString("N"),
                        DevicePingACKMessageUID = Guid.Parse((item as IOutMessageEvent).Context.MessageUid).ToString("N"),
                        RowUpdatedUTC           = DateTime.UtcNow,
                        AckStatusID             = (int)RequestStatus.Pending
                    });
                }
                break;

            case "MTS":
                kafkaObjects.AddRange(_deviceRequestStatusBuilder.BuildMTSDeviceStatusUpdateRequestMessage(deviceDetails, capabilitiesRecord));
                foreach (var item in kafkaObjects.ToList())
                {
                    deviceAckMessages.Add(new DeviceACKMessage
                    {
                        AssetUID                = Guid.Parse((item as IMTSOutMessageEvent).Context.AssetUid).ToString("N"),
                        DeviceUID               = Guid.Parse((item as IMTSOutMessageEvent).Context.DeviceUid).ToString("N"),
                        DevicePingLogUID        = messageUID.ToString("N"),
                        DevicePingACKMessageUID = Guid.Parse((item as IMTSOutMessageEvent).Context.MessageUid).ToString("N"),
                        RowUpdatedUTC           = DateTime.UtcNow,
                        AckStatusID             = (int)RequestStatus.Pending
                    });
                }
                break;

            case "PL":
                kafkaObjects.AddRange(_deviceRequestStatusBuilder.BuildPLDeviceStatusUpdateRequestMessage(deviceDetails, capabilitiesRecord));
                foreach (var item in kafkaObjects.ToList())
                {
                    deviceAckMessages.Add(new DeviceACKMessage
                    {
                        AssetUID                = Guid.Parse((item as IPLOutMessageEvent).Context.AssetUid).ToString("N"),
                        DeviceUID               = Guid.Parse((item as IPLOutMessageEvent).Context.DeviceUid).ToString("N"),
                        DevicePingLogUID        = messageUID.ToString("N"),
                        DevicePingACKMessageUID = Guid.Parse((item as IPLOutMessageEvent).Context.MessageUid).ToString("N"),
                        RowUpdatedUTC           = DateTime.UtcNow,
                        AckStatusID             = (int)RequestStatus.Pending
                    });
                }
                break;
            }
            return(messageUID);
        }
Example #18
0
        /// <summary>
        /// Update device details for a device by passing the updated details themselves.
        /// </summary>
        /// <param name="updatedDetails">The new state of DeviceDetails for the device.</param>
        /// <returns></returns>
        public TaskStatusInfo UpdateDeviceDetails(DeviceDetails updatedDetails)
        {
            var request = new DeviceDetailsRequest();

            MiscUtils.CopyProperties(updatedDetails, request);
            var taskStatusInfo = this.GetStorSimpleClient().DeviceDetails.UpdateDeviceDetails(request, this.GetCustomRequestHeaders());

            return(taskStatusInfo);
        }
Example #19
0
        /// <summary>
        /// Update the specified DeviceDetails object with given network config data
        /// </summary>
        /// <param name="details">DeviceDetails object to be updated</param>
        /// <param name="netConfig">network config object to pick new details from</param>
        private void UpdateDeviceDetailsWithNetworkConfig(DeviceDetails details, NetworkConfig netConfig)
        {
            // See if deviceDetails already has an object for the interface for which network config has been provided.
            // If not, then a new object is to be provided.
            var netInterface = details.NetInterfaceList.FirstOrDefault(x => x.InterfaceId == netConfig.InterfaceAlias);

            if (netInterface == null)
            {
                netInterface = new NetInterface
                {
                    NicIPv4Settings = new NicIPv4(),
                    NicIPv6Settings = new NicIPv6()
                };
                details.NetInterfaceList.Add(netInterface);
            }

            netInterface.IsIScsiEnabled = netConfig.IsIscsiEnabled.HasValue ? netConfig.IsIscsiEnabled.Value : netInterface.IsIScsiEnabled;

            netInterface.IsCloudEnabled = netConfig.IsCloudEnabled.HasValue ? netConfig.IsCloudEnabled.Value : netInterface.IsCloudEnabled;

            if (netConfig.InterfaceAlias == NetInterfaceId.Data0)
            {   // Other interfaces are not supposed to have controller IPs
                if (netConfig.Controller0IPv4Address != null)
                {
                    netInterface.NicIPv4Settings.Controller0IPv4Address = netConfig.Controller0IPv4Address.ToString();
                }
                if (netConfig.Controller1IPv4Address != null)
                {
                    netInterface.NicIPv4Settings.Controller1IPv4Address = netConfig.Controller1IPv4Address.ToString();
                }
            }
            if (netConfig.IPv4Gateway != null)
            {
                netInterface.NicIPv4Settings.IPv4Gateway = netConfig.IPv4Gateway.ToString();
            }
            if (netConfig.IPv4Address != null)
            {
                netInterface.NicIPv4Settings.IPv4Address = netConfig.IPv4Address.ToString();
            }
            if (netConfig.IPv4Netmask != null)
            {
                netInterface.NicIPv4Settings.IPv4Netmask = netConfig.IPv4Netmask.ToString();
            }
            if (netConfig.IPv6Prefix != null)
            {
                netInterface.NicIPv6Settings.IPv6Prefix = netConfig.IPv6Prefix.ToString();
            }
            if (netConfig.IPv6Gateway != null)
            {
                netInterface.NicIPv6Settings.IPv6Gateway = netConfig.IPv6Gateway.ToString();
            }

            // Make sure that the interface gets enabled as well
            netInterface.IsEnabled = true;
        }
        public Program()
        {
            audioDevice    = new XAudio2(XAudio2Flags.DebugEngine, ProcessorSpecifier.AnyProcessor);
            masteringVoice = new MasteringVoice(audioDevice, XAudio2.DefaultChannels, XAudio2.DefaultSampleRate, 0);

            DeviceDetails deviceDetails = audioDevice.GetDeviceDetails(0);

            x3DInstance = new X3DAudio(deviceDetails.OutputFormat.ChannelMask, 340f);

            //x3d.Calculate(listener, emitter, SlimDX.X3DAudio.CalculateFlags.ZeroCenter, 2, 2);
        }
Example #21
0
    public DeviceDetails GetDevice(uint index)
    {
        if (devices == null || devices.Length < index)
        {
            return(null);
        }
        DeviceDetails device = devices[index];

        Debug.Log("Device Id: " + device.DeviceId + "\n" + device.Status);
        return(device);
    }
        public static void ParseTextForDeviceDetails(string text, List <DeviceDetails> deviceDetails)
        {
            List <string> deviceBlob = text.Split('|').ToList();

            deviceBlob.RemoveAt(0);

            foreach (string deviceText in deviceBlob)
            {
                if (deviceText == "\0")
                {
                    continue;
                }

                //bfgminer may have multiple entries for the same key, e.g. Hardware Errors
                //seen with customer data/hardware
                //remove dupes using Distinct()
                var deviceAttributes = deviceText.Split(',').ToList().Distinct();

                Dictionary <string, string> keyValuePairs = deviceAttributes
                                                            .Where(value => value.Contains('='))
                                                            .Select(value => value.Split('='))
                                                            .ToDictionary(pair => pair[0], pair => pair[1]);

                //seen Count == 0 with user API logs
                if (keyValuePairs.Count > 0)
                {
                    DeviceDetails newDevice = new DeviceDetails();

                    newDevice.Index  = int.Parse(keyValuePairs["DEVDETAILS"]);
                    newDevice.Name   = keyValuePairs["Name"];
                    newDevice.ID     = int.Parse(keyValuePairs["ID"]);
                    newDevice.Driver = keyValuePairs["Driver"];
                    if (keyValuePairs.ContainsKey("Device Path"))
                    {
                        newDevice.DevicePath = keyValuePairs["Device Path"];
                    }
                    if (keyValuePairs.ContainsKey("Serial"))
                    {
                        newDevice.Serial = keyValuePairs["Serial"];
                    }
                    if (keyValuePairs.ContainsKey("Kernel"))
                    {
                        newDevice.Kernel = keyValuePairs["Kernel"];
                    }
                    if (keyValuePairs.ContainsKey("Model"))
                    {
                        newDevice.Model = keyValuePairs["Model"];
                    }

                    deviceDetails.Add(newDevice);
                }
            }
        }
Example #23
0
        /// <summary>
        /// Update device details for specified device given the specified data
        /// </summary>
        /// <param name="deviceDetails">Current device details for the device.</param>
        /// <param name="newName">New friendly name for the device. Null if its not to be changed</param>
        /// <param name="timeZone">New timeZone value for the device. Null if its not to be changed</param>
        /// <param name="secondaryDnsServer">New Secondary DNS Server address for the device. Null if its not to be changed</param>
        /// <param name="networkConfigs">An array or NetworkConfig objects for different interfaces. Null if its not to be changed</param>
        /// <returns></returns>
        public TaskStatusInfo UpdateDeviceDetails(DeviceDetails deviceDetails, string newName, TimeZoneInfo timeZone, IPAddress secondaryDnsServer, NetworkConfig[] networkConfigs)
        {
            // Update the object
            this.UpdateDeviceDetailsObject(deviceDetails, newName, timeZone, secondaryDnsServer, networkConfigs);
            // Copy stuff over from the DeviceDetails object into a new DeviceDetailsRequest object.
            var request = new DeviceDetailsRequest();

            MiscUtils.CopyProperties(deviceDetails, request);
            var taskStatusInfo = this.GetStorSimpleClient().DeviceDetails.UpdateDeviceDetails(request, this.GetCustomRequestHeaders());

            return(taskStatusInfo);
        }
Example #24
0
 public ExecutionRecorderParams(string executionId, string host, string username, string password,
                                TestType executionTestType, string baseProjectPath, string testCaseName, DeviceDetails currentDevice,
                                List <ExecutionError> errors)
 {
     ExecutionId       = executionId;
     Host              = host;
     UserName          = username;
     Password          = password;
     ExecutionTestType = executionTestType;
     BaseProjectPath   = baseProjectPath;
     TestCaseName      = testCaseName;
     CurrentDevice     = currentDevice;
     ExecutionErrors   = errors;
 }
 /// <summary>
 /// If a DeviceList is present this list is also updated with the additional details.
 /// </summary>
 /// <param name="deviceId">Device ID of the device</param>
 /// <param name="deviceDetails">Device Details for the specified device.</param>
 private void UpdateDeviceList(string deviceId, DeviceDetails deviceDetails)
 {
     if (DeviceList != null && DeviceList.Count > 0)
     {
         var device = DeviceList.FirstOrDefault(x => x.Id == deviceId);
         if (device != null)
         {
             var pos = DeviceList.FindIndex(x => x.Id == deviceId);
             DeviceList.RemoveAt(pos);
             device = deviceDetails.Device;
             DeviceList.Insert(pos, device);
         }
     }
 }
Example #26
0
        public T ConstructDataOutEvent <T>(DeviceDetails deviceMessage) where T : IOutMessageEvent, new()
        {
            var messageEvent = new T();

            messageEvent.Context = new EventContext
            {
                AssetUid   = deviceMessage.AssetUid.ToString(),
                DeviceId   = deviceMessage.SerialNumber,
                DeviceType = deviceMessage.DeviceType,
                DeviceUid  = deviceMessage.DeviceUid.ToString(),
                EventUtc   = deviceMessage.EventUtc
            };
            return(messageEvent);
        }
 private void txtDialogBox_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //skipPages.Content = deviceDetails;
         deviceDetails = new DeviceDetails(mainWindow, txtPrinterSN.Text, FileTools.commandPath);
         //deviceDetails.ShowDialog();
         skipPages.Content = deviceDetails;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Title, MessageBoxButton.OK);
     }
 }
Example #28
0
        public async Task <SettleTransactionResponse> SettleTransaction(
            string currency,
            string amount,
            string relatedTransactionId,
            string clientUniqueId               = null,
            string clientRequestId              = null,
            string userId                       = null,
            Addendums addendums                 = null,
            string descriptorMerchantName       = null,
            string descriptorMerchantPhone      = null,
            DynamicDescriptor dynamicDescriptor = null,
            UrlDetails urlDetails               = null,
            string authCode                     = null,
            string customData                   = null,
            string comment                      = null,
            string customSiteName               = null,
            string productId                    = null,
            DeviceDetails deviceDetails         = null,
            string rebillingType                = null,
            string authenticationTypeOnly       = null,
            SubMerchant subMerchant             = null)
        {
            var request = new SettleTransactionRequest(
                merchantInfo,
                sessionToken,
                currency,
                amount,
                relatedTransactionId)
            {
                AuthCode                = authCode,
                ClientUniqueId          = clientUniqueId,
                ClientRequestId         = clientRequestId,
                UserId                  = userId,
                Addendums               = addendums,
                DescriptorMerchantName  = dynamicDescriptor?.MerchantName ?? descriptorMerchantName,
                DescriptorMerchantPhone = dynamicDescriptor?.MerchantPhone ?? descriptorMerchantPhone,
                UrlDetails              = urlDetails,
                CustomData              = customData,
                Comment                 = comment,
                CustomSiteName          = customSiteName,
                ProductId               = productId,
                DeviceDetails           = deviceDetails,
                RebillingType           = rebillingType,
                AuthenticationTypeOnly  = authenticationTypeOnly,
                SubMerchant             = subMerchant
            };

            return(await safechargeRequestExecutor.SettleTransaction(request));
        }
Example #29
0
        /// <summary>
        /// Modify the provided DeviceDetails object with the data provided
        /// </summary>
        /// <param name="details"></param>
        private void UpdateDeviceDetailsObject(DeviceDetails deviceDetails, string newName, TimeZoneInfo timeZone, IPAddress secondaryDnsServer, NetworkConfig[] networkConfigs)
        {
            // modify details for non-null data provided to cmdlet

            if (!string.IsNullOrEmpty(newName))
            {
                deviceDetails.DeviceProperties.FriendlyName = newName;
            }

            if (timeZone != null)
            {
                deviceDetails.TimeServer.TimeZone = timeZone.StandardName;
            }

            if (secondaryDnsServer != null)
            {
                var secondaryDnsString = secondaryDnsServer.ToString();
                var secondaryDnsType   = secondaryDnsServer.AddressFamily;
                if (secondaryDnsType == AddressFamily.InterNetwork)   // IPv4
                {
                    deviceDetails.DnsServer.SecondaryIPv4.Clear();
                    deviceDetails.DnsServer.SecondaryIPv4.Add(secondaryDnsString);
                }
                else if (secondaryDnsType == AddressFamily.InterNetworkV6)
                {
                    deviceDetails.DnsServer.SecondaryIPv6.Clear();
                    deviceDetails.DnsServer.SecondaryIPv6.Add(secondaryDnsString);
                }
            }

            if (networkConfigs != null && networkConfigs.Count() > 0)
            {
                foreach (var netConfig in networkConfigs)
                {
                    this.UpdateDeviceDetailsWithNetworkConfig(deviceDetails, netConfig);
                }
            }

            // There are a bunch of details that this cmdlet never edits and the service
            // considers null values for them to mean that there have been no changes.
            deviceDetails.AlertNotification = null;
            deviceDetails.Chap = null;
            deviceDetails.RemoteMgmtSettingsInfo         = null;
            deviceDetails.RemoteMinishellSecretInfo      = null;
            deviceDetails.SecretEncryptionCertThumbprint = null;
            deviceDetails.Snapshot = null;
            deviceDetails.VirtualApplianceProperties = null;
            deviceDetails.WebProxy = null;
        }
Example #30
0
        private void CheckSyncState(ZPushAccount account)
        {
            // TODO: we probably want one invocation for all accounts
            using (ZPushConnection connection = account.Connect())
            {
                // Check total size
                CheckTotalSize(connection);

                // Update sync state
                using (ZPushWebServiceDevice deviceService = connection.DeviceService)
                {
                    // Fetch
                    DeviceDetails details = deviceService.Execute(new GetDeviceDetailsRequest());
                    if (details != null)
                    {
                        bool wasSyncing = false;

                        // Create or update session
                        SyncSession session = account.GetFeatureData <SyncSession>(this, null);
                        if (session == null)
                        {
                            session = new SyncSession(this, account);
                        }
                        else
                        {
                            wasSyncing = session.IsSyncing;
                        }

                        session.Add(details);

                        // Store with the account
                        account.SetFeatureData(this, null, session);

                        if (wasSyncing != session.IsSyncing)
                        {
                            // Sync state has changed, update the schedule
                            Watcher.Sync.SetTaskSchedule(_task, account, session.IsSyncing ? CheckPeriodSync : (TimeSpan?)null);
                        }
                    }
                }
            }

            // Update the total for all accounts
            UpdateTotalSyncState();

            // Check for stalls
            CheckSyncStalled(account);
        }
Example #31
0
 public IPLOutMessageEvent GetFuelMessageForPLOut(DeviceDetails deviceDetails)
 {
     return(new SendQueryCommandEvent
     {
         Context = new EventContext
         {
             AssetUid = deviceDetails.AssetUid.ToString(),
             DeviceId = deviceDetails.SerialNumber,
             DeviceType = deviceDetails.DeviceType,
             DeviceUid = deviceDetails.DeviceUid.ToString(),
             EventUtc = DateTime.UtcNow,
             MessageUid = Guid.NewGuid().ToString()
         },
         Command = PLQueryCommandEnum.FuelLevelQuery
     });
 }