|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 5120 (0x1400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Light_Controller, seg_00fefc
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Panel_Interface;
with Client;
with Message_Types;
with Message_Dispatch;
with Message;
with Network;
with Log_Writer;
with Seats;
package body Light_Controller is
Light_Controller_Id : Client.Id;
-- Client Id for this module. There is a dispatcher task handling
-- requests addressed to this client.
procedure Start is
begin
null; -- Startup automatic during elaboration.
end Start;
procedure Shutdown is
begin
null; -- no explicit shutdown needed.
end Shutdown;
task Dispatcher is
entry Start;
-- The client must be registered in elaboration code before this
-- entry is called. Once called, begin dispatching requests.
end Dispatcher;
task body Dispatcher is
Packet : Message.Packet;
-- This packet is allocated by the Message_Dispatch package and must
-- be explicitly freed here.
function Get_Seat (Cmd : String) return Seats.Seat_Id is
begin
if Cmd'Length >= 2 then
return Seats.Seat_Id'Value (Cmd (Cmd'First + 1 .. Cmd'Last));
else
return 0;
end if;
exception
when others =>
return 0;
end Get_Seat;
begin
accept Start;
loop
begin
-- Get a message
Message_Dispatch.Get_Message (Light_Controller_Id, Packet);
-- Decode message and process.
declare
Cmd : constant String := Message.Packet_Body (Packet);
Seat : Seats.Seat_Id := Get_Seat (Cmd);
begin
-- 1st char T => on F => off, rest of string is seat
-- number.
case Cmd (Cmd'First) is
when 'T' =>
Log_Writer.Log_Message
("Light_Controller",
"Light ON: " & Seats.Seat_Id'Image (Seat));
-- Call physical controller to turn light on
Panel_Interface.Light_On (Seat);
when 'F' =>
Log_Writer.Log_Message
("Light_Controller",
"Light OFF:" & Seats.Seat_Id'Image (Seat));
-- Call physical controller to turn light off
Panel_Interface.Light_Off (Seat);
when others =>
Log_Writer.Log_Message
("Light_Controller.Dispatcher",
"illegal message");
end case;
Message_Dispatch.Free_Buffer (Packet);
exception
when others =>
Log_Writer.Log_Message
("Light_Controller.Dispatcher", "exception");
delay 3.0; -- avoid infinite busy loops
end;
end;
end loop;
end Dispatcher;
begin
-- initialization: Register client and start dispatcher task
Light_Controller_Id := Client.Register ("Light_Controller");
Dispatcher.Start;
end Light_Controller;
nblk1=4
nid=0
hdr6=8
[0x00] rec0=28 rec1=00 rec2=01 rec3=034
[0x01] rec0=1c rec1=00 rec2=02 rec3=064
[0x02] rec0=14 rec1=00 rec2=03 rec3=014
[0x03] rec0=0d rec1=00 rec2=04 rec3=001
tail 0x2150bba8a822f64108558 0x42a00088462060003