Click here to Skip to main content
15,886,664 members
Articles / Mobile Apps

Develop embedded systems based on UML state machines

Rate me:
Please Sign up or sign in to vote.
3.88/5 (9 votes)
1 Jun 2005CPOL3 min read 81.1K   1.3K   37  
This article discovers how to develop and simulate cross-platform embedded systems using the UML State Machine Wizard.
/* =============================================================================
 * Filename:    SrvAgent.h
 * 
 * Copyright  Inc
 * All rights reserved.
 * -----------------------------------------------------------------------------
 * General description of this file:
 * This is the global interface definition for the service agent.
 * -----------------------------------------------------------------------------
 *                               Revision History
 * -----------------------------------------------------------------------------
 * Version   Date      Author          Revision Detail
 * 1.0.0    2004/11/26                 Initial
 * ===========================================================================*/

#ifndef SRV_AGENT_H
#define SRV_AGENT_H

#include "sme.h"
#include "stdafx.h"

#ifdef __cplusplus   
extern "C" {
#endif


/**********************************************************************************************
Thread and external event handle.
*/
BOOL AgtEndAppThread();
BOOL AgtStartAppThread(HWND hSimWinHdl, LPCTSTR sLibFileName, LPCSTR asProcName);
BOOL AgtPostExtEvent(long nEventId, void* pData, int nDataSize, void *pDestPort);

#define WM_SRV_CALL_ID (WM_USER + 1)
#define WM_DEBUG_STR_ID (WM_USER + 2)

/* Create an additional header for service call. */
typedef struct SME_SRV_CALL_DATA_HDR_T
{
	long nSrvCallId;
	unsigned long nDataLen; /* service call data size*/
} SME_SRV_CALL_DATA_HDR_T;

/* The SME_AFTER_SRV_CALL_DATA_HDR structure is used to ensure proper alignment when
 * creating and accessing a message.  The offset of the BeginingOfData
 * field is calculated when skipping over the message header in order to return
 * a pointer to the usable data portion of a message.
 */
typedef struct SME_AFTER_SRV_CALL_DATA_HDR
{
   SME_SRV_CALL_DATA_HDR_T MsgHdr;
   union BeginingOfData
   {
      char int8;
      short int16;
      long int32;
   } BeginingOfData;
} SME_AFTER_SRV_CALL_DATA_HDR;

#define SME_SIZEOF_SRV_CALL_HDR      ((unsigned long)(offsetof(SME_AFTER_SRV_CALL_DATA_HDR, BeginingOfData)))

/* This macro returns a pointer to message header */
#define SME_CALLDATA2HDR(msg_ptr) \
   ((SME_SRV_CALL_DATA_HDR_T *)(((unsigned long) (msg_ptr)) - (SME_SIZEOF_SRV_CALL_HDR)))

/* This macro returns a pointer to message data */
#define SME_HDR2CALLDATA(msg_hdr_p) \
   ((void *)(((unsigned long) (msg_hdr_p)) + (SME_SIZEOF_SRV_CALL_HDR)))

/**********************************************************************************************
Service call agent
*/
BOOL AgtPostServiceCall(long nSrvCallId, void * pCallData, int nDataSize);
BOOL AgtSendServiceCall(long nSrvCallId, void * pCallData, int nDataSize);
BOOL AgtEndServiceCall(SME_SRV_CALL_DATA_HDR_T* pHdr);

#ifdef __cplusplus
}
#endif 

#endif // #define SRVAGENT_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
China China
Jerome. (Free to speak, free to use.)

Comments and Discussions