Jane Avriette > Net-TDMA-0.2 > Net::TDMA::Day



Annotate this POD

View/Report Bugs




Net::TDMA::Day provides the basis for the TDMA communications protocol. Each day in a TDMA link is composed of 112.5 epochs.


        my $tdma_day = Net::TDMA::Day->new(); # no arguments

Your new day will actually have 113 epochs in it, as opposed to giving you 112.5, which is more "correct," but far less practical. At the intersection of one day and the next, you're going to have to figure out how to make that switch.

It is advised that you create a Day, and begin filling it with data that can then be pushed on the wire. If you know what time it is, your day object can tell you which epoch you're in, that epoch can tell you which frame it's supposed to be sending, and that frame is going to know which slot you should be reading (or stuffing on the wire). But normally, we'd just send entire frames.

When your epochs have data that ought to be sent out, you can pack them however you like by defining a serialize function in TDMA::Constants.

This might look something like this:

        my $i = 0; # just an iterator
        my $epoch = $tdma_day->get_epoch( $epoch_number); 

        foreach my $frame ($epoch->get_frames()) {
                # Note that some TDMA implementations, like Link 16, have a limited
                # amount of bandwidth available.
                $_->set_payload("$i++") for @{ $frame->get_slots() }

        $sock->send( $epoch->serialize() );


        Alex J. Avriette
syntax highlighting: