encoder: use switch case to handle CAN protocols