refactored device and platform getters

Now it is possible to get devices by type using type-specific
accessors. No state is preserved, so queries will be repeated each
time the property is accessed. That shouldn't be an issue though,
and caching can be implemented on an as-needed basis.

Also adds error code enums