⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commandserializer.h

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 H
字号:
/***************************************************************************
                          commandserializer.h  -  
                          ---------------
    begin                : Thu Sep 14 2006
    copyright            : (C) 2006 by DigitalAirways
    email                : info@digitalairways.com
 ***************************************************************************/

/*
 * Copyright (c) 2004-2006 DigitalAirways, sarl. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of
 * DigitalAirways, sarl. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DigitalAirways.
 * A copy of this license is included in the licence.txt file included
 * on this software package.
 *
 * $Id: CommandSerializer.h,v 1.3 2006/09/22 12:50:18 cvs Exp $
 *
*/

/*
**************************************************************
* TODO
**************************************************************


**************************************************************
* HISTORY
**************************************************************

  - 
*/

#ifndef __COMMANDSERIALIZER__
#define __COMMANDSERIALIZER__

#include "EB_Utils.h"

#define PENDING_COMMAND_QUEUE_LEN	10
#define SENT_COMMAND_QUEUE_LEN 20

#define COMMAND_STATUS_OK		1
#define COMMAND_STATUS_ERROR	2
#define COMMAND_STATUS_TIMEOUT	3



struct SerializedCommand
{
	unsigned int commandID; 
	KALEIDO_TIME_TYPE requestDate;        // 
	KALEIDO_TIME_TYPE sendDate;           // Time of the sending
	unsigned long msgOK;	      // If ==0, no message is sent in case of OK
	unsigned long msgERROR;	      // If ==0, no message is sent in case of ERROR
	KALEIDO_TIME_TYPE timeout;	          // Maximum delay between the sending and the ack (Should never be met)
						          // If the timeout is reached, msgERROR is sent and the command is discarted.
	void* message;
	void* commandArgs;

	DEFINE_NEW(SerializedCommand);
	DEFINE_DELETE(SerializedCommand);
};


class TAPIManager;
class SmallArrayList;

extern "C"
{

/* used to "send" a stacked command*/
 extern void commandSender(void* message, void* commandArg, unsigned long msgOK,unsigned long msgERROR, KALEIDO_TIME_TYPE timeout) ;

/* used to clean a command */
extern  void commandCleaner(SerializedCommand*) ;

/* used to identify a sent command from a platform event*/
extern  int commandCheckerOK (SerializedCommand*, void* platformMsgID, long krebMsgID) ;

/* used to identify a sent command from a platform event*/
extern  int commandCheckerError (SerializedCommand*, void* platformMsgID, long krebMsgID) ;

extern int allowedToSendCommand();
}

class CommandSerializer 
{	

	

	public:
	// Queue for requests.
	SerializedCommand fPendingCommands[PENDING_COMMAND_QUEUE_LEN];
	SerializedCommand fSentCommands[SENT_COMMAND_QUEUE_LEN];


	
	private:

		TAPIManager* fTapiManager;
	
	// We keep a trace of last request.
	signed int fCurrentCommandIdx; // Index of the next command to execute or the one currently executed
	signed int fEmptyCommandIdx;   // Index of the next empty command slot
	unsigned int fNumberOfCommands;

	unsigned long fCommandID;

	unsigned int cleanPendingCommandSlot(signed int index);	// Clean the command
	unsigned int cleanSentCommandSlot(signed int index);	// Clean the command
	signed int callCommandSlot(signed int index);


	
	public:
	
	DEFINE_NEW(CommandSerializer);
	DEFINE_DELETE(CommandSerializer) ;

	/* BEWARE : when the constructor is called the TAPIManager MUST know its gContext)*/
	CommandSerializer(TAPIManager* comm);
		
		
	virtual ~CommandSerializer();

	/*
	 * Check the state of the current queue
	 */
	virtual KALEIDO_TIME_TYPE checkQueue();

	/*
	 * Manage the current command's ack
	 */
	virtual boolean findAndAckCommand(void* platformMsgID);

	virtual void ackCommand(SerializedCommand* , int status);


	/*  
	 *	a new command to send. args and property are duplicated in sendCommand method
	 */
	virtual void sendCommand( void* message,  void* messageArgs, unsigned long msgOK,unsigned long msgERROR, KALEIDO_TIME_TYPE timeout);
		

	virtual void addMessageInKREBQueue(long msg, long msgArg);

};


#endif // ndef __COMMANDSERIALIZER__


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -