-
Notifications
You must be signed in to change notification settings - Fork 82
Description
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