Пример #1
0
 ///
 /// \brief Eui48 constructor from C++ string
 ///
 /// Parses in form SS:TT:UU:VV:WW:XX:YY:ZZ and
 /// SS-TT-UU-VV-WW-XX-YY-ZZ
 ///
 /// \param s std::string reference
 ///
 Eui64( std::string const &s ) {
     jdksavdecc_eui64_init_from_cstr( this, s.c_str() );
 }
Пример #2
0
int adp( struct raw_context *net, struct jdksavdecc_frame *frame, int argc, char **argv )
{
    int r = 1;
    struct jdksavdecc_eui64 entity_id;
    struct jdksavdecc_adpdu adpdu;
    bzero( &entity_id, sizeof( entity_id ) );
    bzero( &adpdu, sizeof( adpdu ) );
    uint16_t message_type_code;

	printf("%s():-->%d\targc = %d\n", __func__, __LINE__, argc);
    if ( argc > 4 )
    {
        arg_entity_id = argv[4];
        if ( *arg_entity_id == 0 )
        {
            arg_entity_id = 0;
        }
    }

    if ( jdksavdecc_get_uint16_value_for_name( jdksavdecc_adpdu_print_message_type, arg_message_type, &message_type_code ) )
    {
        if ( arg_entity_id )
        {
            if ( !jdksavdecc_eui64_init_from_cstr( &entity_id, arg_entity_id ) )
            {
                fprintf( stderr, "ADP: invalid entity_id: '%s'\n", arg_entity_id );
                return 1;
            }
        }

        if ( adp_form_msg( frame, &adpdu, message_type_code, entity_id ) == 0 )
        {
            if ( raw_send( net, frame->dest_address.value, frame->payload, frame->length ) > 0 )
            {
                if ( arg_verbose > 0 )
                {
                    fprintf( stdout, "Sent:\n" );
                    adp_print( stdout, frame, &adpdu );

                    if ( arg_verbose > 1 )
                    {
                        avdecc_cmd_print_frame_payload( stdout, frame );
                    }
                }
                r = 0;
	printf("\t%s():-->%d\n", __func__, __LINE__);
                avdecc_cmd_process_incoming_raw( &adpdu, net, arg_time_in_ms_to_wait, adp_process );
	printf("\t%s():-->%d\n", __func__, __LINE__);
            }
        }
        else
        {
            fprintf( stderr, "avdecc: unable to form adp message\n" );
        }
    }
    else
    {
        struct jdksavdecc_uint16_name *name = jdksavdecc_adpdu_print_message_type;
        fprintf( stdout, "ADP message type options:\n" );
        while ( name->name )
        {
            fprintf( stdout, "\t0x%04x %s\n", name->value, name->name );
            name++;
        }
    }
    return r;
}
Пример #3
0
 ///
 /// \brief Eui48 constructor from C string
 ///
 /// Parses in form SS:TT:UU:VV:WW:XX:YY:ZZ and
 /// SS-TT-UU-VV-WW-XX-YY-ZZ
 ///
 /// \param s pointer to C string
 ///
 Eui64( const char *s ) {
     jdksavdecc_eui64_init_from_cstr( this, s );
 }