Skip to content

DeviceConfigClient

inflames2k edited this page May 24, 2018 · 1 revision

Description

The DeviceConfigClient interacts with the DeviceConfig-service of the Fritz!Box or devices of other vendors implementing the service.

The client allows to execute a factory reset or a reboot of the device. Additionally the client allowes to get the current device configuration and save it to the file system or upload a new configuration file to the device.

The client allows to get device informations, the device error log and the security port. The security port can be called without authentication.

Method overview

FactoryResetAsync

The method FactoryResetAsync calls the soap action "FactoryReset" of the DeviceConfig-service.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
await client.FactoryResetAsync();

RebootAsync

The method RebootAsync calls the soap action "Reboot" of the DeviceConfig-service.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
await client.RebootAsync();

GetConfigFileAsync

The method GetConfigFileAsync calls the soap action "GetConfigFile" of the DeviceConfig-service and returns the remote path to the config file.

The method takes a password for encrypting the config file before it's temporarily served on the given path.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string configFile = await client.GetConfigFileAsync("secret");

DownloadConfigFileAsync

The method DownloadConfigFileAsync reads the config file from the device and stores it on the filesystem. Internally the method calls GetConfigFileAsync to get the path of the config file. The method takes a password for encrypting the config file. Internally the method calls GetConfigFileAsync to tell the device to serve the config file.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
await client.DownloadConfigFileAsync(@"C:\temp", "secret");

GetPersistentDataAsync

The method GetPersistentDataAsync calls the soap action "GetPersistentData" of the DeviceConfig-service. It returns the stored data string.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string persistentData = await client.GetPersistentDataAsync();

SetPersistentDataAsync

The method SetPersistentDataAsync calls the soap action "SetPersistentData" of the DeviceConfig-service. It stores a given string to the persistent data storage.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
await client.SetPersistentDataAsync("Hello World");

GenerateUUIDAsync

The method GenerateUUIDAsync calls the soap action "GenerateUUID" of the DeviceConfig-service. It returns a new sessionid as string. The generated sessionid can be used to access the configuration interfaces transactional. For starting and stopping transactions the method StartConfigurationAsync and FinishConfigurationAsync are provided.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string uuid = await client.GenerateUUIDAsync();

StartConfigurationAsync

The method StartConfigurationAsync calls the soap action "ConfigurationStarted" of the DeviceConfig-service. It starts a configuration transaction and takes a sessionid as parameter.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string sessionid = await client.GenerateUUIDAsync();
await client.StartConfigurationAsync(sessionid);

FinishConfigurationAsync

The method FinishConfigurationAsync calls the soap action "ConfigurationFinished" of the DeviceConfig-service. This will end a started transaction. The method returns a state message for the configuration changes during the transaction.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string state = await client.FinishConfigurationAsync();

GenerateUrlSIDAsync

For some interfaces of the TR-064 protocol implemented by AVM an UrlSID is required to access the provided soap actions (e.g. calling the phonebook or the call list). The method GenerateUrlSIDAsync calls the soap action "GenerateUrlSID" and returns an UrlSID that can be used for accessing interfaces that require a sid.

Usage example:

DeviceConfigClient client = new DeviceConfigClient("https://fritz.box", 10000, username, password);
string urlSID = await client.GenerateUrlSIDAsync();