コード例 #1
0
void ieee802frame154_dump( TiFrame * f )
{
    int8 len;
    TiIEEE802Frame154Descriptor meta;

    len = frame_length(f);
	if (len > 0)
	{   
		dbc_putchar( '>' );
	 	dbc_n8toa( len );
		 ieee802frame154_open( &meta );
        if (ieee802frame154_parse(&meta, frame_startptr(f), frame_length(f)))
        {
			dbc_putchar( ':' );
			dbc_write_n8toa( frame_startptr(f), len );
			dbc_putchar( 0xFC );
			dbc_putchar( '\r' );
			dbc_putchar( '\n' );
			}
		else{
            // if parsing failed, then we also output the data
            dbc_putchar( 0xFC );
			dbc_write_n8toa( frame_startptr(f), len );
			dbc_putchar( '\r' );
			dbc_putchar( '\n' );
			}
		}
		 else{
        // If the f doesn't contain any data, then still output some flag for indication.
        dbc_putchar( 0xFB );
        dbc_putchar( 0xFB );
    }
}
コード例 #2
0
ファイル: tinymac_recv.c プロジェクト: ericyao2013/openwsn
void _output_frame( TiFrame * frame, TiUartAdapter * uart )
{
    static TiIEEE802Frame154Descriptor m_desc;
    TiIEEE802Frame154Descriptor * desc;

	if (frame_totallength(frame) > 0)
	{   
		dbc_putchar( '>' );
	 	dbc_n8toa( frame_totallength(frame) );

        desc = ieee802frame154_open( &m_desc );
        // ? if (ieee802frame154_parse(desc, frame_startptr(frame), frame_length(frame)))
        if (ieee802frame154_parse(desc, frame_startptr(frame), frame_capacity(frame)))
        {
            // if the frame received is parsed successfully, then output it to the
            // computer through debugging channel

            //ieee802frame154_set_sequence( desc, seqid ++ );
		    //ieee802frame154_set_panto( desc, CONFIG_ALOHA_DEFAULT_PANID );
		    //ieee802frame154_set_shortaddrto( desc, CONFIG_ALOHA_REMOTE_ADDRESS );
		    //ieee802frame154_set_panfrom( desc, CONFIG_ALOHA_PANID);
		    //ieee802frame154_set_shortaddrfrom( desc, CONFIG_ALOHA_LOCAL_ADDRESS );

            // todo: you can output more
            // reference frame_dump() in rtl_frame.c

            dbc_n8toa( ieee802frame154_sequence(desc) );
			dbc_putchar( ':' );
			dbc_write( frame_startptr(frame), frame_capacity(frame) );
		}
		else{
	        // if the frame received is parsed failed, then output the error frame
            // to the computer through debugging channel

	        dbc_putchar( 'X' );
			dbc_putchar( ':' );
			dbc_write( frame_startptr(frame), frame_capacity(frame) );
		}
		dbc_putchar( '\r' );
		dbc_putchar( '\n' );
	}
}
コード例 #3
0
ファイル: rtl_dumpframe.c プロジェクト: gxp/node
void ieee802frame154_dumpmembuf( char * buf, int len )
{
    TiIEEE802Frame154Descriptor * desc;

	 if (len > 0)
	{   
		dbc_putchar( '>' );
	 	dbc_n8toa( len );

        desc = ieee802frame154_open( &m_desc );
        if (ieee802frame154_parse(desc, buf, len))
        {
            // if the frame received is parsed successfully, then output it to the
            // computer through debugging channel

            //ieee802frame154_set_sequence( desc, seqid ++ );
		    //ieee802frame154_set_panto( desc, CONFIG_ALOHA_DEFAULT_PANID );
		    //ieee802frame154_set_shortaddrto( desc, CONFIG_ALOHA_REMOTE_ADDRESS );
		    //ieee802frame154_set_panfrom( desc, CONFIG_ALOHA_PANID);
		    //ieee802frame154_set_shortaddrfrom( desc, CONFIG_ALOHA_LOCAL_ADDRESS );

            // todo: you can output more
            // reference frame_dump() in rtl_frame.c
           
            dbc_n8toa( ieee802frame154_sequence(desc) );
			dbc_putchar( ':' );
			dbo_write( buf, len );
		}
		else{
	        // if the frame received is parsed failed, then output the error frame
            // to the computer through debugging channel

	        dbc_putchar( 'X' );
			dbc_putchar( ':' );
			dbo_write( buf, len );
		}
		dbc_putchar( '\n' );
	}
}
コード例 #4
0
void ieee802frame154_dump( TiFrame * f )
{
    int8 len;
    TiIEEE802Frame154Descriptor meta;

    len = frame_length(f);
	if (len > 0)
	{   
		
		dbc_putchar( 0xFA );
		dbc_putchar( 0xFA );
	    dbc_putchar( frame_curlayer(f) );
	 	dbc_putchar( len );

        // if the frame received is parsed successfully, then output it to the
        // computer through debugging channel
        //
        ieee802frame154_open( &meta );
        if (ieee802frame154_parse(&meta, frame_startptr(f), frame_length(f)))
        {
            // todo: you can output more
            // reference frame_dump() in rtl_frame.c

			dbc_putchar( 0xFB );
			dbc_write( frame_startptr(f), len );
			dbc_putchar( 0xFC );
		}
		else{
            // if parsing failed, then we also output the data
            dbc_putchar( 0xFC );
			dbc_write( frame_startptr(f), len );
		}
	}
    else{
        // If the f doesn't contain any data, then still output some flag for indication.
        dbc_putchar( 0xFB );
        dbc_putchar( 0xFB );
    }
}