/*=============================================================================

FILE:  AEELoggerTypes.h

SERVICES:  
   AEE Logging data types to share between the BREW Core, Developer, and PC

DESCRIPTION:
   This file provides defintions for the logging data types that need to be 
   shared between the phone and log parser

        Copyright © 1999-2002 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
=============================================================================*/

#ifndef AEELOGGERTYPES_H
#define AEELOGGERTYPES_H

//=============================================================================
//  VARIABLE AND TYPE DEFINITIONS
//=============================================================================

//-----------------------------------------------------------------------------
//            Defines
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//      Type Declarations
//-----------------------------------------------------------------------------
    
#ifndef AEECLSID
#define AEECLSID  uint32
#endif  // AEECLSID

#define AEE_LOG_VERSION                      1     // BREW log version

#define MAX_LOG_TYPE_BIN_MSG_ARGS            3     // Max number of args allowed for
                                                   // AEE_LOG_TYPE_BIN_MSG

#define MAX_LOG_TYPE_BIN_MSG_FILENAME_SIZE   20

#define MAX_LOG_TYPE_BIN_MSG_TEXT_SIZE       80    // Max length of ASCII text message
                                                   // which is the combination of a null 
                                                   // terminated filename followed by a 
                                                   // null terminated message

// BREW logging priorities
typedef  uint16                     AEELogPriorityType;
#define  AEE_LOG_LVL_LOW            0
#define  AEE_LOG_LVL_MED            1
#define  AEE_LOG_LVL_HIGH           2
#define  AEE_LOG_LVL_URGENT         3
#define  AEE_LOG_LVL_ERROR          4 

// BREW logging item types
typedef  uint16                     AEELogItemType;
// predefined log item types
#define  AEE_LOG_TYPE_TEXT          0x000    // ASCII text message
#define  AEE_LOG_TYPE_BIN_MSG       0x001    // AEELogTypeBinMsg
#define  AEE_LOG_TYPE_BIN_BLK       0x002    // binary data block
// user defined log item type
#define  AEE_LOG_TYPE_USER_BASE     0x100           // User must define own type structure
                                                    // for each user type they use
#if defined( AEE_SIMULATOR ) | defined( _WIN32 )
#define PACKED
#endif

#if defined( AEE_SIMULATOR) | defined( _WIN32 )
#pragma pack(push,1)
#endif

// BREW log record header
typedef PACKED struct{
   uint8                version;    // Log record header version (AEE_LOG_VERSION)
   AEECLSID             classID;    // Class ID of the currently running application
   uint16               instanceID; // InstanceID is a developer defined ID number that can be used
                                    // as the developer wishes.  Possible uses are to distinguish
                                    // between different application thread, or different applicaiton
                                    // run-time states.
   AEELogItemType       type;       // Log type
   AEELogPriorityType   level;      // Log priority level
   uint16               nSize;      // Size in bytes of the following user data
} AEELogRcdHdrType;

// BREW log record
typedef PACKED struct{
   AEELogRcdHdrType     hdr;        // Log header
   uint8               *data;       // Log type's data
} AEELogRecord;

// BREW binary log type structure definition
typedef PACKED struct{
   uint8                header;        // b7,b6    - bits reserved
                                       // b5,b4    - number of args
                                       // b3 bit   - file name present
                                       // b2,b1,b0 - message level
   uint32               line;          // line number in application code where
                                       // this log item was sent
   uint32               args[   MAX_LOG_TYPE_BIN_MSG_ARGS  ];
   char                 pszMsg[ MAX_LOG_TYPE_BIN_MSG_TEXT_SIZE ];
                                       // pszMsg contains two consecutive NULL
                                       // terminated strings.  The first if the
                                       // file name where the log message was
                                       // sent, and the second is an ASCII text
                                       // message
} AEELogBinMsgType;       

#if defined( AEE_SIMULATOR) | defined( _WIN32 )
#pragma pack(pop,1)
#endif

#endif    // AEELOGGERTYPES_H

/*=============================================================================
   DATA TYPE DOCUMENTATION
===============================================================================
===============================================================================
Name: AEELogPriorityType

Description:
   Defines list of log item priorities usable by the application

Definition:

   // BREW logging priorities
   typedef  uint16                     AEELogPriorityType;
   #define  AEE_LOG_LVL_LOW            0
   #define  AEE_LOG_LVL_MED            1
   #define  AEE_LOG_LVL_HIGH           2
   #define  AEE_LOG_LVL_CRITICAL       3
   #define  AEE_LOG_LVL_ERROR          4 
                                 
Comments:
   How these priorites are used is up to the application and the end receiver of
   log items

See Also:
   None

===============================================================================
===============================================================================
Name: AEELogItemType

Description:
   These are the different log types that distinguish the structure of the data
   contained in the log item.  AEE_LOG_TYPE_USER_BASE and above are available for application
   developers to define thier own log data formats.  The application developer
   is responsible for eleminating any conflicts that may arrise due to multiple
   apps using the same log type.

Definition:

   // BREW logging item types
   typedef  uint16                     AEELogItemType;
   // predefined log item types
   #define  AEE_LOG_TYPE_TEXT          0x000    // ASCII text message
   #define  AEE_LOG_TYPE_BIN_MSG       0x001    // AEELogTypeBinMsg
   #define  AEE_LOG_TYPE_BIN_BLK       0x002    // binary data block
   // user defined log item type
   #define  AEE_LOG_TYPE_USER_BASE     0x100           // User must define own type structure
                                                       // for each user type they use
                                 
Comments:
   None

See Also:
   None

===============================================================================
===============================================================================
Name: AEELogRcdHdrType

Description:
      Standard BREW log header version 1
      This header is appended to the beginning of each outgoing
      log packet.

Definition:

   // BREW log record header
   typedef PACKED struct{
      uint8                version;    // Log record header version (AEE_LOG_VERSION)
      AEECLSID             classID;    // Class ID of the currently running application
      uint16               instanceID; // InstanceID is a developer defined ID number that can be used
                                       // as the developer wishes.  Possible uses are to distinguish
                                       // between different application thread, or different applicaiton
                                       // run-time states.
      AEELogItemType       type;       // Log type
      AEELogPriorityType   level;      // Log priority level
      uint16               nSize;      // Size in bytes of the following user data
   } AEELogRcdHdrType;

See Also:
   None

===============================================================================
===============================================================================
Name: AEELogRecord

Description:
   All log records are passed down to the OEM layer using this structure.

Definition:

   // BREW log record
   typedef PACKED struct{
      AEELogRcdHdrType     hdr;        // Log header
      uint8               *data;       // Log type's data
   } AEELogRecord;
                                 
Comments:
   None

See Also:
   None

===============================================================================
===============================================================================
Name: AEELogBinMsgType

Description:
   This represents the structure of the log data when uisng brew log type
   AEE_LOG_TYPE_BIN_MSG as defined above.  ILOGGER_PutMsg fills
   this structure using its function arguments.

Definition:

   // BREW binary log type structure definition
   typedef PACKED struct{
      uint8                header;        // b7,b6    - bits reserved
                                          // b5,b4    - number of args
                                          // b3 bit   - file name present
                                          // b2,b1,b0 - message level
      uint32               line;          // line number in application code where
                                          // this log item was sent
      uint32               args[   MAX_LOG_TYPE_BIN_MSG_ARGS  ];
      char                 pszMsg[ MAX_LOG_TYPE_BIN_MSG_TEXT_SIZE ];
                                          // pszMsg contains two consecutive NULL
                                          // terminated strings.  The first if the
                                          // file name where the log message was
                                          // sent, and the second is an ASCII text
                                          // message
   } AEELogBinMsgType;  
                                 
Comments:
   None

See Also:
   None

===============================================================================*/

// end AEELoggerTypes.h
