Refactoring of CoAP base driver