|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 3540 (0xdd4)
Types: TextFile
Names: »B«
└─⟦bfaa708f6⟧ Bits:30000531 8mm tape, Rational 1000, INSIGHT 1_3_0
└─⟦c51948655⟧ »DATA«
└─⟦266b31e86⟧
└─⟦this⟧
with Client;
with Message_Types;
with Message_Dispatch;
with Message;
with Network;
with Light_Controls;
with Log_Writer;
with Lights;
pragma Elaborate (Client);
package body Dispatch_Light_Commands is
function "+" (A, B : Lights.Light_Id) return Lights.Light_Id
renames Lights."+";
Lights_Id : Client.Id; -- Client Id of the light manager. This is the
-- central controller module that handles management of cabin lighting.
Emergency_Lighting_Id : Client.Id; -- Id of handler for emergency msgs.
procedure Start is
begin
null; -- startup is done in the elaboration code.
end Start;
procedure Stop is
begin
null; -- no shutdown is needed.
end Stop;
procedure Emergency is
begin
Emergency_Lighting_Id := Client.Register ("Emergency_Lighting");
-- This function is not yet implemented
end Emergency;
task Dispatcher is
entry Start;
-- The Dispatcher task cannot be started until the elaboration code
-- registers the Light_Controller client. Then, the Dispatcher
-- listens for requests to control lights. Requests come from
-- seat buttons and are routed to light controllers.
end Dispatcher;
task body Dispatcher is
-- This packet is allocated by the Message_Dispatch package and
-- must be freed by code here after use.
Packet : Message.Packet;
begin
accept Start;
loop
begin
-- First, read a network message for this client
Message_Dispatch.Get_Message (Lights_Id, Packet);
-- Got a message. Decode it.
declare
Cmd : constant String := Message.Packet_Body (Packet);
Light : Light_Controls.Light_Id;
begin
-- 1st char T => on F => off, rest of string is seat
-- number.
Light := Light_Controls.Light_Of
(Cmd (Cmd'First + 1 .. Cmd'Last));
case Cmd (Cmd'First) is
when 'T' =>
-- Turn on light
Light_Controls.On (Light);
when 'F' =>
-- Turn off light
Light_Controls.Off (Light);
when 'C' =>
-- Service agent call
Light_Controls.Toggle (Light + 100); -- offset to
-- service call light from seat light. (bogus)
when others =>
Log_Writer.Log_Message
("Cabin_Operations.Dispatch_light_commands",
"illegal message");
end case;
-- Release buffer packet.
Message_Dispatch.Free_Buffer (Packet);
exception
when others =>
Log_Writer.Log_Message
("Cabin_Operations.Dispatch_light_commands",
"exception");
delay 5.0; -- avoid infinite busy loops
end;
end;
end loop;
end Dispatcher;
begin
-- initialization: Register this client. Then start the dispatcher task.
Lights_Id := Client.Register ("Light_Manager");
Dispatcher.Start;
end Dispatch_Light_Commands;