/* This module would be included from the file * in the usual case */ module Erlang { typedef sequence Atom; // struct Node { ... } // struct Reference { ... } // etc. // this could be an unsigned long for a simple switch(msg.op) typedef Atom Operation; // The first field could be some magic number struct Command { Operation op; sequence args_in; }; struct Control { Operation op; sequence args_in; }; struct Control_RV { sequence args_out; }; }; module CAN { typedef Erlang::Atom CAN_Ref; typedef sequence Data; struct Message { boolean remote; unsigned long arbitration_id; Data bytes; }; exception Value_Error { string reason; }; interface Driver { void init(); void open(in string ifc, out CAN_Ref ifc_ref) raises (Value_Error); void close(); /* oneway operations may not raise exceptions */ oneway void send_message(in CAN_Ref ifc_ref, in Message msg); oneway void send(in CAN_Ref ifc_ref, in unsigned long arbitration_id, in boolean remote, in Data bytes); }; interface PortOwner { /* Only oneway operations */ oneway void on_message(in CAN_Ref ifc_ref, in Message msg); oneway void network_failure(in CAN_Ref ifc_ref, in string reason); }; };