Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA Enterprise SCADA

OCM_Init method

  • Last UpdatedApr 24, 2025
  • 1 minute read

Omnicomm invokes the OCM_INIT method implemented by your protocol assembly to register the different methods for handling different communication functions. Invoke the setPollCmdHandler method within the OCM_INIT method for all the different commands that your protocol supports. The setPollCmdHandler method requires a slot number of a protocol record, a command type, and a function pointer.

If desired, use the GetProtocolSlot method to simplify the process of acquiring a slot number (see GetProtocolSlot method).

In the example below, a protocol called "MyProtocol" has been created, along with a protocol record with the name "MyProtocol". The GetProtocolSlot method fetches the slot number of the specified protocol record based on its name. Your OCM_Init function then uses this slot number to register its functions for different command types with Omnicomm.

extern "C" LIBRTGSIM void OCM_Init()

{

auto protoSlot = GetProtocolSlot("MyProtocol");

setPollCmdHandler(protoSlot, SCH_POLL, (pollCmdHandlerType)myProtocolPollMethod);

setPollCmdHandler(protoSlot, SCH_DIGCMD, (pollCmdHandlerType)myProtocolDigCmd);

setPollCmdHandler(protoSlot, SCH_SETPOINT, (pollCmdHandlerType)myProtocolSetPnt);

}

Related Links