How would you protect internal state and provide clean interfaces using encapsulation in embedded software?