text
stringlengths
0
234
end Is_Entry_Compatible;
function Is_Entry_Writable
(This : Object_Dictionary;
Index : Entry_Index)
return Boolean
is
begin
if This.Entry_Exist (Index.Object, Index.Sub) then
return This.Object (Index.Object).Entries (Index.Sub).Is_Writable;
else
return False;
end if;
end Is_Entry_Writable;
function Is_Entry_Readable
(This : Object_Dictionary;
Index : Entry_Index)
return Boolean
is
begin
if This.Entry_Exist (Index.Object, Index.Sub) then
return This.Object (Index.Object).Entries (Index.Sub).Is_Readable;
else
return False;
end if;
end Is_Entry_Readable;
function Get_Entry
(This : Object_Dictionary;
Index : Object_Index;
Subindex : Object_Subindex) return Entry_Base'Class
is
(This.Object (Index).Entries (Subindex).all);
procedure Set_Entry
(This : in out Object_Dictionary;
New_Entry : in Entry_Base'Class;
Index : in Object_Index;
Subindex : in Object_Subindex;
Silently : in Boolean := False)
is
begin
This.Object (Index).Entries (Subindex).all := New_Entry;
if not Silently then
This.Events.Node_Events.Put
((Event => ACO.Events.OD_Entry_Update,
Index => (Index, Subindex)));
end if;
end Set_Entry;
procedure Set_Node_State
(This : in out Object_Dictionary;
Node_State : in ACO.States.State)
is
Prev : ACO.States.State;
begin
Prev := This.Node_State;
This.Node_State := Node_State;
This.Events.Node_Events.Put
((Event => ACO.Events.State_Transition,
State => (Previous => Prev, Current => Node_State)));
end Set_Node_State;
function Get_Node_State (This : Object_Dictionary) return ACO.States.State is
(This.Node_State);
function Get_Hbt_Node_Id (Reg : U32) return ACO.Messages.Node_Nr is
(ACO.Messages.Node_Nr (Shift_Right (Reg, 16) and 16#FF#));
function Get_Hbt_Slave_Subindex
(This : Object_Dictionary;
Node_Id : ACO.Messages.Node_Nr)
return Object_Subindex
is
Object : constant Object_Ref := This.Object (Heartbeat_Consumer_Index);
begin
for I in 1 .. Object.Entries'Last loop
declare
E_Ref : constant Entry_Ref := Object.Entries (I);
Reg : constant U32 := Entry_U32 (E_Ref.all).Read;
use type ACO.Messages.Node_Nr;
begin
if Get_Hbt_Node_Id (Reg) = Node_Id then
return Object_Subindex (I);
end if;
Function Definition: function To_Data_Array is new Ada.Unchecked_Conversion (From, To);
Function Body: begin
return To_Data_Array (D);
end Convert;
function Convert (D : ACO.Messages.Data_Array)
return STM32.CAN.Message_Data
is
subtype From is ACO.Messages.Data_Array (D'Range);
subtype To is STM32.CAN.Message_Data (D'Range);
function To_Message_Data is new Ada.Unchecked_Conversion (From, To);
begin
return To_Message_Data (D);