WindowsDevicePortalWrapper icon indicating copy to clipboard operation
WindowsDevicePortalWrapper copied to clipboard

Change IP-Address (IPv4)

Open SebZar opened this issue 7 years ago • 0 comments

Hi, can you add the support to change the network settings of a device?

At the moment I use this snipped to set a IPv4 configuration, but it would be nice to have this feature in the wrapper.

`HttpClient client = new HttpClient(); // client.BaseAddress = new System.Uri(DevicePortalAddress, UriKind.RelativeOrAbsolute); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( "Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes( string.Format("{0}:{1}", .DevicePortalUsername, DevicePortalPassword))) ); var newConfig = new NetworkConfiguration() { AdapterName = AdapterName, IPAddress = IPAddress, SubnetMask = SubnetMask, DefaultGateway = DefaultGateway, PrimaryDNS = PrimaryDNS, SecondryDNS = SecondryDNS }; // string json = JsonConvert.SerializeObject(newConfig); // HttpContent content = new StringContent(json); // await client.PutAsync("api/networking/ipv4config", content);

internal class NetworkConfiguration {

    public string AdapterName { get; set; }

    public string IPAddress { get; set; }

    public string SubnetMask { get; set; }

    public string DefaultGateway { get; set; }

    public string PrimaryDNS { get; set; }

    public string SecondryDNS { get; set; }

}

`

Thanks

lg

SebZar avatar Aug 13 '18 08:08 SebZar