Global Positioning System Reference
In-Depth Information
the order of creating the objects does not imply that they will be ready at the
same time. After this initial phase the hardware components are powered
up and in a state to process commands, that is, the software objects are
instantiated.
The program (environment) using the new objects could continue like
this:
Show ballgame = tvGuide.find( "NFL basketball", TONIGHT )
Show news = tvGuide.find( "news", "8:00pm", "CBS" )
The program creates two Show objects describing a \show" with attributes:
starttime , endtime , channel , name , description , ... . The electronic pro-
gram guide (EPG) implies an online connection to a current program guide
and can be used to look up and return certain shows by using the method
find . The EPG API offers the method with different signatures:
ˆ find(showname,showtime)
The EPG will be searched for the entry "NFL basketball" in the predened
time range TONIGHT on TODAY s date.
ˆ find(showname,showtime,channel)
This find narrows the search by providing the specific channel to search.
By providing these find methods as part of an API, the actual searching
of an entry is completely hidden from the programmer of the video appli-
cation. After having found the ballgame and the news items (with duration
and stoptime ), the application can utilize them in the next steps of the
programming logic:
wait until (ballgame.starttime == clock.now )
then do
vcr.Tuner.setChannel( ballgame.getChannel )
vcr.record( vcr.Receiver.getSignal )
until ballgame.stoptime
The above code snippet implies yet another object and device: a clock.
The clock component is used by a timer to compare the starttime of the
ballgame with the current time. When the ball game starts, a receiver is
tuned to the ball game's channel and the stream is directed to be recorded
on hard disc until the ball game's end time is reached.
A second loop is waiting for the news at eight and will turn on the televi-
sion and set the news channel. The waiting loops should run independently
of each other, and the television should have its own receiver, so as not to
disturb the recording of the ball game.
wait until (news.starttime == clock.now)
then do
tv.turnOn
tv.Tuner.setChannel( news.getChannel )
until news.stoptime
 
Search WWH ::




Custom Search