Opened 13 years ago

Closed 13 years ago

#1202 closed enhancement (fixed)

PJLIB System Information API

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.10
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

This ticket implements system information API in PJLIB. The purpose of this API is to provide application with various info about the system so that it can decide things to do at run-time.

There two main parts of this ticket:

1) Compile time info about PJLIB version number in <pj/config.h>:

/** PJLIB version major number. */
#define PJ_VERSION_NUM_MAJOR	1

/** PJLIB version minor number. */
#define PJ_VERSION_NUM_MINOR	8

/** PJLIB version revision number. */
#define PJ_VERSION_NUM_REV	10

/**
 * Extra suffix for the version (e.g. "-trunk"), or empty for
 * web release version.
 */
#define PJ_VERSION_NUM_EXTRA	"-trunk"

/**
 * PJLIB version number consists of three bytes with the following format:
 * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision
 * number, 00: always zero for now.
 */
#define PJ_VERSION_NUM	((PJ_VERSION_NUM_MAJOR << 24) |	\
			 (PJ_VERSION_NUM_MINOR << 16) | \
			 (PJ_VERSION_NUM_REV << 8))

2) System information API in <pj/os.h>:

/**
 * These enumeration contains constants to indicate support of miscellaneous
 * system features. These will go in "flags" field of #pj_sys_info structure.
 */
typedef enum pj_sys_info_flag
{
    /**
     * Support for Apple iOS background feature.
     */
    PJ_SYS_HAS_IOS_BG = 1

} pj_sys_info_flag;


/**
 * This structure contains information about the system. Use #pj_get_sys_info()
 * to obtain the system information.
 */
typedef struct pj_sys_info
{
    /**
     * Null terminated string containing processor information (e.g. "i386",
     * "x86_64"). It may contain empty string if the value cannot be obtained.
     */
    pj_str_t	machine;

    /**
     * Null terminated string identifying the system operation (e.g. "Linux",
     * "win32", "wince"). It may contain empty string if the value cannot be
     * obtained.
     */
    pj_str_t	os_name;

    /**
     * A number containing the operating system version number. By convention,
     * this field is divided into four bytes, where the highest order byte
     * contains the most major version of the OS, the next less significant
     * byte contains the less major version, and so on. How the OS version
     * number is mapped into these four bytes would be specific for each OS.
     * For example, Linux-2.6.32-28 would yield "os_ver" value of 0x0206201c,
     * while for Windows 7 it will be 0x06010000 (because dwMajorVersion is
     * 6 and dwMinorVersion is 1 for Windows 7).
     *
     * This field may contain zero if the OS version cannot be obtained.
     */
    pj_uint32_t	os_ver;

    /**
     * Null terminated string identifying the SDK name that is used to build
     * the library (e.g. "glibc", "uclibc", "msvc", "wince"). It may contain
     * empty string if the value cannot eb obtained.
     */
    pj_str_t	sdk_name;

    /**
     * A number containing the SDK version, using the numbering convention as
     * the "os_ver" field. The value will be zero if the version cannot be
     * obtained.
     */
    pj_uint32_t	sdk_ver;

    /**
     * A longer null terminated string identifying the underlying system with
     * as much information as possible.
     */
    pj_str_t	info;

    /**
     * Other flags containing system specific information. The value is
     * bitmask of #pj_sys_info_flag constants.
     */
    pj_uint32_t	flags;

} pj_sys_info;


/**
 * Obtain the system information.
 *
 * @return	System information structure.
 */
PJ_DECL(const pj_sys_info*) pj_get_sys_info(void);

Change History (10)

comment:1 Changed 13 years ago by bennylp

(In [3423]) Initial implementation for re #1202 (PJILB System Information API) for Linux/Unix?

comment:2 Changed 13 years ago by bennylp

(In [3424]) Implementation of re #1202 (PJLIB System Information API) on Win32 and Windows mobile targets

comment:3 Changed 13 years ago by bennylp

(In [3426]) Re #1202 (pjlib sysinfo): testing on OpenSolaris? and added pjlib-test entry

comment:4 Changed 13 years ago by ming

(In [3428]) Implementation of re #1202 (PJLIB System Information API) on iPhone OS.

comment:5 Changed 13 years ago by ming

(In [3430]) Re #1202: Fixed aconfigure for iPhone OS

comment:6 Changed 13 years ago by ming

(In [3433]) Re #1202: Fixed detection for iPhone simulator.

comment:7 Changed 13 years ago by ming

(In [3434]) Re #1202: Fixed compilation error in os_info_iphone.m on iPhoneSimulator

comment:8 Changed 13 years ago by ming

(In [3436]) Re #1202: Fixed compilation preprocessor for os_info so that it's more robust across various device and simulator SDKs.

comment:9 Changed 13 years ago by nanang

(In [3437]) Implementation of re #1202 (PJLIB System Information API) on Symbian/S60 platforms.

comment:10 Changed 13 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.