Complete refactoring

* Set device name.
* Physically detect device.
* Reset device to factory settings.
* Code coverage and coding style support.
* Guard support.