#!/usr/bin/env python # -*- coding: utf-8 -*- """Quick test script for new message definitions.""" from pymsc.core.message_definitions import msg_a1, msg_a2, msg_b7 from pymsc.core.field_mappings import get_field_path print("=" * 60) print("Testing New Message Definitions") print("=" * 60) # Test 1: Message structure print("\n1. Message Structure Test:") print(f" msg_a2 type: {type(msg_a2)}") print(f" msg_a2._internal type: {type(msg_a2._internal)}") print(f" msg_a2 has rdr_mode_command: {hasattr(msg_a2._internal, 'rdr_mode_command')}") print(f" msg_a2 has param1: {hasattr(msg_a2._internal, 'param1')}") # Test 2: Field mapping print("\n2. Field Mapping Test:") test_fields = ['stby', 'freeze', 'range_scale', 'rdr_mode_command'] for field in test_fields: path = get_field_path('A2', field) print(f" A2.{field} -> {path}") # Test 3: Field access (read) print("\n3. Field Access Test (nested paths):") try: # Test direct nested path access val = msg_a2.get_field_value('rdr_mode_command.stby') print(f" msg_a2.get_field_value('rdr_mode_command.stby') = {val}") except Exception as e: print(f" ERROR: {e}") # Test 4: Legacy API compatibility print("\n4. Legacy API Test:") try: # Test legacy flat field name val = msg_a2.get_value_for_field('stby') print(f" msg_a2.get_value_for_field('stby') = {val}") except Exception as e: print(f" ERROR: {e}") # Test 5: B7 tellback structure print("\n5. B7 Tellback Structure:") print(f" msg_b7._internal type: {type(msg_b7._internal)}") print(f" msg_b7 has rdr_mode_tellback: {hasattr(msg_b7._internal, 'rdr_mode_tellback')}") print("\n" + "=" * 60) print("Test Complete!") print("=" * 60)