def _get_msg_class(code):
    """Get the message class based on the message code."""
    msg_classes = {}
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50,
                                 StandardReceive)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_EXTENDED_MESSAGE_RECEIVED_0X51,
                                 ExtendedReceive)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_X10_MESSAGE_RECEIVED_0X52,
                                 X10Received)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_ALL_LINKING_COMPLETED_0X53,
                                 AllLinkComplete)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_BUTTON_EVENT_REPORT_0X54,
                                 ButtonEventReport)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_USER_RESET_DETECTED_0X55,
                                 UserReset)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_0X56,
                                 AllLinkCleanupFailureReport)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_ALL_LINK_RECORD_RESPONSE_0X57,
                                 AllLinkRecordResponse)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_ALL_LINK_CLEANUP_STATUS_REPORT_0X58,
                                 AllLinkCleanupStatusReport)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_GET_IM_INFO_0X60,
                                 GetImInfo)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_SEND_ALL_LINK_COMMAND_0X61,
                                 SendAllLinkCommand)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_SEND_STANDARD_MESSAGE_0X62,
                                 StandardSend)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_X10_MESSAGE_SEND_0X63,
                                 X10Send)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_START_ALL_LINKING_0X64,
                                 StartAllLinking)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_CANCEL_ALL_LINKING_0X65,
                                 CancelAllLinking)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_RESET_IM_0X67,
                                 ResetIM)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_GET_FIRST_ALL_LINK_RECORD_0X69,
                                 GetFirstAllLinkRecord)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_GET_NEXT_ALL_LINK_RECORD_0X6A,
                                 GetNextAllLinkRecord)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_MANAGE_ALL_LINK_RECORD_0X6F,
                                 ManageAllLinkRecord)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_SET_IM_CONFIGURATION_0X6B,
                                 SetIMConfiguration)
    msg_classes = _add_msg_class(msg_classes,
                                 MESSAGE_GET_IM_CONFIGURATION_0X73,
                                 GetImConfiguration)

    return msg_classes.get(code, None)
def _get_msg_class ( code ) : msg_classes = { } msg_classes = _add_msg_class ( msg_classes , MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50 , StandardReceive ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_EXTENDED_MESSAGE_RECEIVED_0X51 , ExtendedReceive ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_X10_MESSAGE_RECEIVED_0X52 , X10Received ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_ALL_LINKING_COMPLETED_0X53 , AllLinkComplete ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_BUTTON_EVENT_REPORT_0X54 , ButtonEventReport ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_USER_RESET_DETECTED_0X55 , UserReset ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_0X56 , AllLinkCleanupFailureReport ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_ALL_LINK_RECORD_RESPONSE_0X57 , AllLinkRecordResponse ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_ALL_LINK_CLEANUP_STATUS_REPORT_0X58 , AllLinkCleanupStatusReport ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_GET_IM_INFO_0X60 , GetImInfo ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_SEND_ALL_LINK_COMMAND_0X61 , SendAllLinkCommand ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_SEND_STANDARD_MESSAGE_0X62 , StandardSend ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_X10_MESSAGE_SEND_0X63 , X10Send ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_START_ALL_LINKING_0X64 , StartAllLinking ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_CANCEL_ALL_LINKING_0X65 , CancelAllLinking ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_RESET_IM_0X67 , ResetIM ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_GET_FIRST_ALL_LINK_RECORD_0X69 , GetFirstAllLinkRecord ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_GET_NEXT_ALL_LINK_RECORD_0X6A , GetNextAllLinkRecord ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_MANAGE_ALL_LINK_RECORD_0X6F , ManageAllLinkRecord ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_SET_IM_CONFIGURATION_0X6B , SetIMConfiguration ) msg_classes = _add_msg_class ( msg_classes , MESSAGE_GET_IM_CONFIGURATION_0X73 , GetImConfiguration ) return msg_classes . get ( code , None )
Get the message class based on the message code.