/*****************************************************************************
** al_basictypes.h: AL Layer Basic Data Type
**
** Description: This file provides some portable typedefs, in a manner
** comparable to that of C99's <inttypes.h> but portable to C/C++ compilers
**
** Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved
**
** Author : anlzhao
**
** $Id: al_basictypes.h 1916 2011-01-24 09:55:40Z anlzhao_c1 $
*****************************************************************************/

#ifndef AL_BASICTYPES_H_INCLUDED
#define AL_BASICTYPES_H_INCLUDED

/*
* AL null pointer
*/
#define al_null	((void *)0)

#ifdef __cplusplus
extern "C"
{
#endif

//#define printf 	printf
/*
 * AL void type.
 */
typedef void al_void;

/*
 * A portable typedef for a signed integral type of exactly 8 bits.
 */
typedef char al_int8;

/*
 * A portable typedef for an unsigned integral type of exactly 8 bits.
 */
typedef unsigned char al_uint8;

/*
 * A portable typedef for a signed integral type of exactly 16 bits.
 */
typedef short al_int16;

/*
 * A portable typedef for an unsigned integral type of exactly 16 bits.
 */
typedef unsigned short al_uint16;

/*
 * A portable typedef for an signed integral type of exactly 32 bits.
 */
typedef int al_int;

/*
 * A portable typedef for a signed integral type of exactly 32 bits.
 */
typedef int al_int32;

/*
 * A portable typedef for an unsigned integral type of exactly 32 bits.
 */
typedef unsigned int al_uint;

/*
 * A portable typedef for an unsigned integral type of exactly 32 bits.
 */
typedef unsigned int al_uint32;

/*
 * A portable typedef for an signed integral type of at least 32 bits.
 */
typedef long al_long;

/*
 * A portable typedef for an unsigned integral type of at least 32 bits.
 */
typedef unsigned long al_ulong;

/*
 * A portable typedef for an unsigned integral type of exactly 64 bits,
 * represented as two 32-bit words.
 */
typedef struct al_uint64
{
    al_uint32 high; /**< High 32 bits */
    al_uint32 low;  /**< Low 32 bits */
} al_uint64;

/*
 * A portable typedef for a boolean type.
 */
typedef enum al_bool
{
    al_false = 0, /* Boolean false */
    al_true = 1 /* Boolean true */
} al_bool;

/*
** Various return values of the Framework component functions.
** The error type is 4 bytes long, and it divided into 2 parts logically:
** One for module ID, which is the highest 3 bytes, and the other is error
** number, which is the least byte. Currently module ID is defined as below:
** DATABASE - 0x000001XX
** EVENT - 0x000002XX
** SETTING - 0x000003XX
** SERVICE - 0x000004XX
** SCHEDULER - 0x000005XX
** REMINDER - 0x000006XX
** SCAN - 0x000007XX
** RATING - 0x000008XX
** PLAY - 0x000009XX
** NAVIGATION - 0x00000AXX.
** for these representation, XX means the error number.
*/
typedef enum AL_return {
	AL_FAILURE = -1,
	AL_SUCCESS = 0,

	/* Common Error */
	AL_INVALID_PARAM			= 0x00000001,
	AL_MEMORY_ALLOC_FAILED		= 0x00000002,
	AL_CORRUPTED_MEMORY			= 0x00000003,
	AL_UNINITIALIZED			= 0x00000004,
	AL_NOT_SUPPORTED			= 0x00000005,
	AL_INITIALIZE_ALREADY		= 0x00000006,

	/* Database special error type */
	AL_DATABASE_START			= 0x00000100,
	AL_DB_NEED_LOADDEFAULT		= AL_DATABASE_START,
	AL_DB_RECORD_EXIST,
	AL_DB_DATABASE_FULL,
	AL_DATABASE_END				= 0x000001ff,

	/* EPG special error type */
	AL_EVENT_START				= 0x00000200,
	AL_EVENT_NOT_AVAILABLE,
	AL_EVENT_END					= 0x000002ff,

	/* Setting special error type */
	AL_SETTING_START			= 0x00000300,
	AL_SETTING_STORAGE_RESET_ALL = 0x00000301,
	AL_SETTING_STORAGE_RESET_INTERNAL = 0x00000302,
	AL_SETTING_STORAGE_RESET_INTERNAL_USER = 0x00000303,
	AL_SETTING_STORAGE_RESET_USER = 0x00000304,
	AL_SETTING_STORAGE_RESET_MAX = 0x0000031f,
	AL_SETTING_END				= 0x000003ff,

	/* Service special error type */
	AL_SERVICE_START			= 0x00000400,
	AL_SERVICE_END				= 0x000004ff,

	/* SCHEDULER special error type */
	AL_SCHEDULER_START			= 0x00000500,
	AL_SCHEDULER_LAPSED,
	AL_INVALID_SCH_ID,
	AL_SCHEDULER_END			= 0x000005ff,

	/* REMINDER special error type */
	AL_REMINDER_START			= 0x00000600,
	AL_REMINDER_OVERLAP_START_TIME = AL_REMINDER_START,
	AL_REMINDER_OVERLAP_START_TIME_WITHOTHERTIMER,
	AL_REMINDER_OVERLAP_SRC_TIME,
	AL_REMINDER_OVERLAP_REC_TIME,
	AL_REMINDER_SCHE_EVENT_FULL,
	AL_REMINDER_SRV_NOT_PRESENT,
	AL_REMINDER_EVENT_NOT_PRESENT,
	AL_REMINDER_EVENT_EXPIRED,
	AL_REMINDER_END				= 0x000006ff,

	/* SCAN special error type */
	AL_SCAN_START				= 0x00000700,
	AL_SCAN_END					= 0x000007ff,

	/* RATING special error type */
	AL_RATING_START				= 0x00000800,
	AL_RATING_BLOCKED			= AL_RATING_START,
	AL_RATING_ALLOWED,
	AL_RATING_UNRATED, /* Unrated service or event */
	AL_RATING_END				= 0x000008ff,

	/* PLAY special error type */
	AL_PLAY_START				= 0x00000900,
	AL_PLAY_END					= 0x000009ff,

	/* NAVIGATION special error type */
	AL_NAVIGATION_START			= 0x00000A00,
	AL_NAVIGATION_END			= 0x00000Aff,

	/* Time */
	AL_TIME_START				= 0x00000B00,
	AL_TIME_NOT_SET			= AL_TIME_START,
	AL_TIME_END					= 0X00000Bff,
} AL_Return_t;

#ifdef __cplusplus
}
#endif

#endif /* AL_BASICTYPES_H_INCLUDED */

/*****************************************************************************
** $Rev: 1916 $
**
*****************************************************************************/
