#ifndef _AEEDEVICENOTIFIER_H_
#define _AEEDEVICENOTIFIER_H_
/*======================================================
FILE:      aeedevicenotifier.h

SERVICES:  Device Level Notifier.

GENERAL DESCRIPTION:

   Device-level notification for such as flip and keyguard events.

PUBLIC CLASSES AND STATIC FUNCTIONS:

    IDeviceNotifier

INITIALIZATION & SEQUENCING REQUIREMENTS:

	See Exported Routines

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

#include "AEEComdef.h"
#include "AEEInterface.h"
#include "AEEClassIDs.h"

// Standard Device Notifier Masks
// 
#define NMASK_DEVICENOTIFIER_FLIP         0x00000001
#define NMASK_DEVICENOTIFIER_KEYGUARD     0x00000002
#define NMASK_DEVICENOTIFIER_HEADSET      0x00000008
#define NMAKE_DEVICENOTIFIER_SCR_ROTATE   0x00000010

#define NMASK_DEVICENOTIFIER_ALL          (NMASK_DEVICENOTIFIER_FLIP | NMASK_DEVICENOTIFIER_KEYGUARD | \
                                           NMASK_DEVICENOTIFIER_HEADSET | NMASK_DEVICENOTIFIER_SCR_ROTATE)


// Device Notification Context Sensitive Data
//
typedef struct _AEEDeviceNotify
{
   uint16      wParam;
   uint32      dwParam;
} AEEDeviceNotify;


// Screen Orientation
//
typedef uint16 AEEScrOrientation;
#define AEE_SO_PORTRAIT       0
#define AEE_SO_LANDSCAPE      1


typedef uint32 AEEFlipInfo;
// AEEFlipInfo 
//  +--------+--------+--------+--------+
//  | x-axis | y-axis | z-axis |   ID   |
//  +--------+--------+--------+--------+
//   LBS                             MSB
//
//  x-axis/y-axis/z-axis are expressed in 2 degree increments, 0-deg being close and 180-deg being wide open.
//  ID is the number uniquely identifying a flip for multiple flip devices (starting from 0).
//


// Utility Macros
#define DEVNOTIFY_MAKE(x,y,z,i)  (((uint32)(x)<<24) | ((uint32)(y)<<16) | ((uint32)(z)<<8) | ((uint32)(i)))
#define DEVNOTIFY_GET_X(d)       ((d)>>24 & 0xff)
#define DEVNOTIFY_GET_Y(d)       ((d)>>16 & 0xff)
#define DEVNOTIFY_GET_Z(d)       ((d)>>8  & 0xff)
#define DEVNOTIFY_GET_ID(d)      ((d)     & 0xff)


/*=====================================================================
  DATA STRUCTURES DOCUMENTATION
=======================================================================

Device Notifier Masks

Description:
    This is a 32-bit integer used to identify the notification from specific
    device events. These events correspond to EVT_FLIP, EVT_KEYGUARD, 
    EVT_HEADSET and EVT_SCR_ROTATE.

Definition:
   uint32

Members:
   NMASK_DEVICENOTIFIER_FLIP: flip event notification 
   NMASK_DEVICENOTIFIER_KEYGUARD: key-guard event notification
   NMASK_DEVICENOTIFIER_HEADSET: headset event notification
   NMASK_DEVICENOTIFIER_SCR_ROTATE: screen rotation notification 

Comments:
    None

See Also:
    None

=======================================================================

AEEDeviceNotify

Description:
   This is the structure passed in as the context sensitive data in AEENotify
   of EVT_NOTIFY (pData::AEENotify) for the notifications triggered by:
   - NMASK_DEVICENOTIFIER_FLIP
   - NMASK_DEVICENOTIFIER_KEYGUARD
   - NMASK_DEVICENOTIFIER_HEADSET
   - NMAKE_DEVICENOTIFIER_SCR_ROTATE

Definition:
   struct _AEEDeviceNotify
   {
      uint16      wParam;
      uint32      dwParam;
   } AEEDeviceNotify;

Members:
   wParam: the same wParam value that is passed in for the corresponding events
   dwParam: the same dwParm value that is passed in for the corresponding events

Comments:
   None

See Also:
   EVT_NOTIFY, EVT_FLIP, EVT_KEYGUARD, EVT_KEYGUARD, EVT_HEADSET, EVT_SCR_ROTATE
  
=======================================================================

AEEFlipInfo

Description:
   This is a 32-bit unisgned integer used for dwParam of EVT_FLIP and EVT_KEYGUARD.
     +--------+--------+--------+--------+
     | x-axis | y-axis | z-axis |   ID   |
     +--------+--------+--------+--------+
      LBS                             MSB
   
     x-axis/y-axis/z-axis are expressed in 2 degree increments, 0-deg being close and 180-deg being wide open.
     ID is the number uniquely identifying a flip for multiple flip devices (starting from 0).

   You can use the following macros to construct this value or get components from this value:
   - DEVNOTIFY_MAKE: Given the x, y, z and ID, it'll construct the AEEFlipInfo value.
   - DEVNOTIFY_GET_X: Given an AEEFlipInfo value, it will get the x component value.
   - DEVNOTIFY_GET_Y: Given an AEEFlipInfo value, it will get the y component value.
   - DEVNOITFY_GET_Z: Given an AEEFlipInfo value, it will get the z component value.
   - DEVNOTIFY_GET_ID: Given an AEEFlipInfo value, it will get the ID component value.

Members:
   None

Comments:
   None

See Also:
   EVT_FLIP, EVT_KEYGUARD

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

#endif /* _AEEDEVICENOTIFIER_H_ */

