//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//	$Revision: 1 $																//
//																				//
//	Name       : SwiSMSEngine.h													//
//                                                                              //
//	Purpose    : Main application declaration for SwiSMSEngine					//
//																				//
//	Copyright (c) 2002-2003 Sierra Wireless, Inc.  All rights reserved			//
//																				//
//////////////////////////////////////////////////////////////////////////////////

#ifndef SMSENGINE_H
#define SMSENGINE_H

class CMTListCtrl;

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

class CSMSMsgFrag
{
public:
	CSMSMsgFrag();
	CSMSMsgFrag(CSMSMsgFrag& MsgFrag);
	~CSMSMsgFrag();
	CSMSMsgFrag & operator= (CSMSMsgFrag & msgFrag);
	
	ULONG m_Index;
	BYTE  m_FragmentNum;
	WCHAR m_TextMessage[512];
};

class CSMSMsgInfo
{
public:
	CSMSMsgInfo();
	CSMSMsgInfo(CSMSMsgInfo& msgInfo);
	~CSMSMsgInfo();
	CSMSMsgInfo & operator= (CSMSMsgInfo & msgInfo);

	ULONG m_StorageType;
	ULONG m_Tag;
	ULONG m_Format;
	ULONG m_RefNum;
	WCHAR  m_SenderAddr[14];
	BYTE  m_TimeStamp[7];
	BYTE  m_TotalFragments;

	CList <CSMSMsgFrag, CSMSMsgFrag&> m_MsgFragList;
};


/////////////////////////////////////////////////////////////////////////////
// CSMSEngine:
// See SwiSMSEngine.cpp for the implementation of this class
//

class CSMSEngine
{
public:
	CSMSEngine();
	~CSMSEngine();

	void StartupEngine(CMTListCtrl* pInboxUI);
	void DeleteMessage(ULONG msgHandle);
	void DeleteAllMessages(void);
	void GetNewMessage(ULONG storageType, ULONG msgIndex);
	void ChangeMessageStatus(ULONG msgHandle);

	CList <CSMSMsgInfo, CSMSMsgInfo&> m_Inbox;
protected:
	
	CMTListCtrl* m_pInboxUI;

// Implementation
	POSITION FindMessage(ULONG storageType, ULONG format, ULONG refNum, BYTE totalFragments);
	void ChangeInboxDisplay(BOOLEAN newMsg, POSITION pos);

};


/////////////////////////////////////////////////////////////////////////////

#endif // !defined(SMSENGINE_H)
