Step 3. Write your AMIP Application

Use amipsample.cpp as a template for writing your application. You will need to provide your own application code for:

main

OnAlarmInfo

OnStatus

OnShutdown

NotifyStopOnError

 

Step 3.1

Compile and Link Your AMIP Application.

Step 3.2

Test Your AMIP Application.

 

Example:

#include <inc_path/amip.h>

class CAMIPSample : public CAMIPBase

{

            …

            …

            …

      public:

virtual void      OnAlarmInfo(CAlarmUpdateInfo *pAlarmInfo);

virtual void      OnShutdown();

virtual void      OnStatus(COR_STATUS *pStatus);

};

void CAMIPSample:: OnAlarmInfo(CAlarmUpdateInfo *pAlarmInfo)

{

      DumpToOutput(pAlarmInfo);

}

      void CAMIPSample::OnShutdown()

      {

            Message("Shutdown");

      }

      void CAMIPSample::OnStatus(COR_STATUS *pStatus)

{

      DumpToOutput(pStatus);

}

….

….

….

// main application

// synchronous processing

BOOL SyncProcess()

{

      CAMPLSample sample;

      if (sample.GetLastError() !=CAMIPBase::errorNo)

            return FALSE;

      // start AMIP process

      return sample.Start();

}

// asynchronous processing

BOOL AsyncProcess()

{

      CAMIPSample sample;

      if (sample.GetLastError() !=CAMIPBase::errorNo)

            return FALSE;

      // start AMIP process

      if (!sample.Start(TRUE))

            return FALSE;

      // do some other processing

      …

      …

      …

      …

      // stop AMIP process

      return sample.Stop();

}

More information

Use the Alarm Interested Process (AMIP) API.