Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Brew mp Simulator Help said:
===========================
To simulate a camera device

1. Ensure that a DirectShow compliant camera device is connected to the system.

2. Load a device pack that simulates a camera device. Device packs with this enabled will have the Camera section Camera Support as Yes and Camera CLSID Configuration section Support as Yes.

3. Run the application that uses the ICamera APIs.

The Simulator detects and connects to the first available camera device on the system. The Simulator displays the results on the device skin just as on a real device.
===========================

Question is:
what device pack supports it or how to make a device pack to support it?
i cant find any divece pack editors etc.
Please post the detail steps

Thanks

You can find the device configurator to edit the device packs under the tools\deprecated directory of the BMP SDK.
-Tony

You can find the device configurator to edit the device packs under the tools\deprecated directory of the BMP SDK.
-Tony

hi Tony,
How can I get live preview via PC-Cam on the Brew MP simulator?
Thanks

hi Tony,
How can I get live preview via PC-Cam on the Brew MP simulator?
Thanks

If testing on the Simulator, you need to have a "direct show" compliant web cam attached to the computer and use the Brew MP 1.0 SDK rev 1.0 or greater. In addition, the MIF file must have privileges for AEEPRIVID_PLFILE and AEECLSID_CAMERA.
Then you should be able to follow the steps below to get the preview going:
Requirements
To display an image:
Set the image size. The image size is the resolution of the image captured.
Set the display size. The display size is the size of the frame returned to the application.
Set the preview type.
Set the encoding information.
Set the output parameters.
Verify the camera is in the Ready mode.
Change the mode to Preview.
In the callback function, show the frame.
When you are done viewing the frame, all ICAMERA_Stop() to stop showing the frame. This will return the ICamera object to the ready mode.
Event handling
The callback function recieves the AEECameraNotify structure as a parameter. The callback function checks the nStatus field for CAM_STATUS_FRAME and CAM_STATUS_DONE.
When the nStatus field is CAM_STATUS_FRAME, a new frame is available to be displayed. The application calls ICamera_GetFrame() to retrieve a pointer to the raw frame. The orientation (portrait vs landscape) can be determined by calling IBitmap_GetInfo(). The application then calls IDISPLAY_BitBlt () to prompt the camera to process the image and copy the processed frame to a display buffer. To display the new frame, call IDISPLAY_Update( ).
When the nStatus field is CAM_STATUS_DONE, the application can save the snapshot or movie to a file.
Example - Show a frame
Set the image size of the picture or movie.
nErr = ICAMERA_SetSize(pMe->pICamera, &pMe->ImageSize);
Set the display size of the device.
nErr = ICAMERA_SetDisplaySize(pMe->pICamera, &pMe->ImageSize);
Set the preview type. This example sets the preview type to snapshot.
nErr = ICAMERA_SetParm(pMe->pICamera,CAM_PARM_PREVIEW_TYPE, CAM_PREVIEW_SNAPSHOT, 0);
Set the output media. This example sets the output media for a snapshot.
//set media data output to a file with the name SNAPSHOT_FILE_NAME
md.clsData = MMD_FILE_NAME;
md.pData = (void*)SNAPSHOT_FILE_NAME; // a constant in the sample app
md.dwSize = 0;
nErr = ICAMERA_SetMediaData(pMe->pICamera, &md,"image/jpeg" ) ;
Verify that ICamera is in the ready mode.
ICAMERA_GetMode(pMe->pICamera, &nMode, NULL);
if(nMode == CAM_MODE_READY)
{
// continue

Change the ICamera object's mode to preview (CAM_MODE_PREVIEW). This will trigger a series of asynchronous events that are delivered to the application via the callback function.
//change the mode to preview
nErr = ICAMERA_Preview(pMe->pICamera);
In the callback function, handle the CAM_STATUS_FRAME status:
case CAM_STATUS_FRAME:
{
// A new frame is available, Get the raw frame, check orientation and blit it to the screen
IBitmap * pFrame;
AEEBitmapInfo BitmapInfo;
ICAMERA_GetFrame( pMe->pICamera, &pFrame );
if (!pFrame) break;
//Check to see if the raw frame does not have the same orientation
// as what expected. If they are not the same, rotate the preview so
// that the final image on the screen is rotated correctly. This
// will handle the different mounting possitions of the camera.
IBitmap_GetInfo(pFrame, &BitmapInfo, sizeof(AEEBitmapInfo));
if (BitmapInfo.cx == pMe->ImageSize.cy && BitmapInfo.cy == pMe->ImageSize.cx )
{
DBGPRINTF("Frame is %d by %d. Expected %d by %d", BitmapInfo.cx, BitmapInfo.cy, pMe->ImageSize.cx, pMe->ImageSize.cy );
if (!pMe->bAdjustedPreviewRotate)
{
nErr = ICAMERA_SetParm(pMe->pICamera, CAM_PARM_ROTATE_PREVIEW, 90, 0);
DBGPRINTF("Rotating the image - nErr is %d", nErr);
pMe->bAdjustedPreviewRotate = TRUE;
}
}
IDISPLAY_BitBlt(pMe->Applet.m_pIDisplay, 0, 0, pMe->ImageSize.cx, pMe->ImageSize.cy,
pFrame, 0, 0, AEE_RO_COPY);
//Display buffer is now updated, need to update the screen
IDISPLAY_Update(pMe->Applet.m_pIDisplay);
IBITMAP_Release(pFrame);
break;
}
-Tony

If testing on the Simulator, you need to have a "direct show" compliant web cam attached to the computer and use the Brew MP 1.0 SDK rev 1.0 or greater. In addition, the MIF file must have privileges for AEEPRIVID_PLFILE and AEECLSID_CAMERA.
Then you should be able to follow the steps below to get the preview going:
Requirements
To display an image:
Set the image size. The image size is the resolution of the image captured.
Set the display size. The display size is the size of the frame returned to the application.
Set the preview type.
Set the encoding information.
Set the output parameters.
Verify the camera is in the Ready mode.
Change the mode to Preview.
In the callback function, show the frame.
When you are done viewing the frame, all ICAMERA_Stop() to stop showing the frame. This will return the ICamera object to the ready mode.
Event handling
The callback function recieves the AEECameraNotify structure as a parameter. The callback function checks the nStatus field for CAM_STATUS_FRAME and CAM_STATUS_DONE.
When the nStatus field is CAM_STATUS_FRAME, a new frame is available to be displayed. The application calls ICamera_GetFrame() to retrieve a pointer to the raw frame. The orientation (portrait vs landscape) can be determined by calling IBitmap_GetInfo(). The application then calls IDISPLAY_BitBlt () to prompt the camera to process the image and copy the processed frame to a display buffer. To display the new frame, call IDISPLAY_Update( ).
When the nStatus field is CAM_STATUS_DONE, the application can save the snapshot or movie to a file.
Example - Show a frame
Set the image size of the picture or movie.
nErr = ICAMERA_SetSize(pMe->pICamera, &pMe->ImageSize);
Set the display size of the device.
nErr = ICAMERA_SetDisplaySize(pMe->pICamera, &pMe->ImageSize);
Set the preview type. This example sets the preview type to snapshot.
nErr = ICAMERA_SetParm(pMe->pICamera,CAM_PARM_PREVIEW_TYPE, CAM_PREVIEW_SNAPSHOT, 0);
Set the output media. This example sets the output media for a snapshot.
//set media data output to a file with the name SNAPSHOT_FILE_NAME
md.clsData = MMD_FILE_NAME;
md.pData = (void*)SNAPSHOT_FILE_NAME; // a constant in the sample app
md.dwSize = 0;
nErr = ICAMERA_SetMediaData(pMe->pICamera, &md,"image/jpeg" ) ;
Verify that ICamera is in the ready mode.
ICAMERA_GetMode(pMe->pICamera, &nMode, NULL);
if(nMode == CAM_MODE_READY)
{
// continue

Change the ICamera object's mode to preview (CAM_MODE_PREVIEW). This will trigger a series of asynchronous events that are delivered to the application via the callback function.
//change the mode to preview
nErr = ICAMERA_Preview(pMe->pICamera);
In the callback function, handle the CAM_STATUS_FRAME status:
case CAM_STATUS_FRAME:
{
// A new frame is available, Get the raw frame, check orientation and blit it to the screen
IBitmap * pFrame;
AEEBitmapInfo BitmapInfo;
ICAMERA_GetFrame( pMe->pICamera, &pFrame );
if (!pFrame) break;
//Check to see if the raw frame does not have the same orientation
// as what expected. If they are not the same, rotate the preview so
// that the final image on the screen is rotated correctly. This
// will handle the different mounting possitions of the camera.
IBitmap_GetInfo(pFrame, &BitmapInfo, sizeof(AEEBitmapInfo));
if (BitmapInfo.cx == pMe->ImageSize.cy && BitmapInfo.cy == pMe->ImageSize.cx )
{
DBGPRINTF("Frame is %d by %d. Expected %d by %d", BitmapInfo.cx, BitmapInfo.cy, pMe->ImageSize.cx, pMe->ImageSize.cy );
if (!pMe->bAdjustedPreviewRotate)
{
nErr = ICAMERA_SetParm(pMe->pICamera, CAM_PARM_ROTATE_PREVIEW, 90, 0);
DBGPRINTF("Rotating the image - nErr is %d", nErr);
pMe->bAdjustedPreviewRotate = TRUE;
}
}
IDISPLAY_BitBlt(pMe->Applet.m_pIDisplay, 0, 0, pMe->ImageSize.cx, pMe->ImageSize.cy,
pFrame, 0, 0, AEE_RO_COPY);
//Display buffer is now updated, need to update the screen
IDISPLAY_Update(pMe->Applet.m_pIDisplay);
IBITMAP_Release(pFrame);
break;
}
-Tony

I'm getting the error EPRIVLEVEL in ISHELL_CreateInstance.
coding given below:
/*=============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================*/
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEECamera.h" // Camera interface definitions
#include "camera_app.bid"
#include "camera_app_res.h"
/*=============================================================================
Applet structure. All variables in here are referenced via "pMe->"
=============================================================================*/
// Create an applet structure that's passed around. All variables in
// here will be able to be referenced as static.
typedef struct _camera_app {
AEEApplet Applet; // First element of this structure must be AEEApplet
AEEDeviceInfo DeviceInfo;// Always have access to the hardware device info
IDisplay *pIDisplay; // Give a standard way to access the Display interface
IShell *pIShell; // Give a standard way to access the Shell interface
int nWidth; // Stores the device screen width
int nHeight; // Stores the device screen height
// Add your own variables here...
ICamera *pICamera;
camera_app;
/*=============================================================================
Function Prototypes
=============================================================================*/
static boolean camera_app_HandleEvent(camera_app* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam);
boolean camera_app_InitAppData(camera_app* pMe);
void camera_app_FreeAppData(camera_app* pMe);
void camera_app_OnCamera(void *pUser, AEECameraNotify *pNotify);
int camera_app_InitializeCamera(camera_app *pMe);
int camera_app_StopCamera(camera_app *pMe);
int camera_app_PreviewCamera(camera_app *pMe);
void camera_app_OnPreview(camera_app *pMe);
void camera_app_OnKey(camera_app *pMe, uint16 key);
/*=============================================================================
FUNCTION DEFINITIONS
=============================================================================*/
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po,
void **ppObj)
{
*ppObj = NULL;
if( AEECLSID_CAMERA_APP == ClsId ) {
// Create the applet and make room for the applet structure
if( TRUE == AEEApplet_New(sizeof(camera_app),
ClsId,
pIShell,
po,
(IApplet**)ppObj,
(AEEHANDLER)camera_app_HandleEvent,
(PFNFREEAPPDATA)camera_app_FreeAppData) ) {
// FreeAppData is called after sending EVT_APP_STOP to HandleEvent
// Initialize applet data, this is called before sending
// EVT_APP_START to the HandleEvent function
if(TRUE == camera_app_InitAppData(
(camera_app*)*ppObj)) {
// Data initialized successfully
return(AEE_SUCCESS);
}
else {
// Release the applet. This will free the memory allocated for
// the applet when AEEApplet_New was called.
IApplet_Release((IApplet*)*ppObj);
return (EFAILED);
}
} // End AEEApplet_New
}
return(EFAILED);

static boolean camera_app_HandleEvent(camera_app* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode) {
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
camera_app_InitializeCamera(pMe);
camera_app_PreviewCamera(pMe);
return(TRUE);
// App is told it is exiting
case EVT_APP_STOP:
// Add your code here...
return(TRUE);
// App is being suspended
case EVT_APP_SUSPEND:
// Add your code here...
return(TRUE);
// App is being resumed
case EVT_APP_RESUME:
// Add your code here...
return(TRUE);
// An SMS message has arrived for this app.
// The Message is in the dwParam above as (char *).
// sender simply uses this format "//BREW:ClassId:Message",
// example //BREW:0x00000001:Hello World
case EVT_APP_MESSAGE:
// Add your code here...
return(TRUE);
// A key was pressed. Look at the wParam above to see which key was
// pressed. The key codes are in AEEVCodes.h. Example "AVK_1" means
// that the "1" key was pressed.
case EVT_KEY:
// Add your code here....
camera_app_OnKey(pMe, wParam);
return(TRUE);
// Clamshell has opened/closed
// wParam = TRUE if open, FALSE if closed
case EVT_FLIP:
// Add your code here...
return(TRUE);
// Clamtype device is closed and reexposed when opened, and LCD
// is blocked, or keys are locked by software.
// wParam = TRUE if keygaurd is on
case EVT_KEYGUARD:
// Add your code here...
return (TRUE);
// If nothing fits up to this point then we'll just break out
default:
break;
}
return (FALSE);

// This function is called when your application is starting up
boolean camera_app_InitAppData(camera_app* pMe)
{
// Get the device information for this handset.
// Reference all the data by looking at the pMe->DeviceInfo structure
// Check the API reference guide for all the handy device info you can get
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->Applet.m_pIShell,&pMe->DeviceInfo);
pMe->pIDisplay = pMe->Applet.m_pIDisplay;
pMe->pIShell = pMe->Applet.m_pIShell;
pMe->nWidth = pMe->DeviceInfo.cxScreen; // Cache width of device screen
pMe->nHeight = pMe->DeviceInfo.cyScreen; // Cache height of device screen
// Insert your code here for initializing or allocating resources...
pMe->pICamera = NULL;
// If there have been no failures up to this point then return success
return (TRUE);

// This function is called when your application is exiting
void camera_app_FreeAppData(camera_app* pMe)
{
// Insert your code here for freeing any resources you have allocated...
// Example to use for releasing each interface:
// if ( pMe->pIMenuCtl != NULL ) { // check for NULL first
// IMenuCtl_Release(pMe->pIMenuCtl)// release the interface
// pMe->pIMenuCtl = NULL; // set to NULL so no problems later
// }
//
camera_app_StopCamera(pMe);

void camera_app_OnCamera(void *pUser, AEECameraNotify *pNotify)
{
camera_app *pMe = (camera_app *)pUser;
switch (pNotify->nStatus)
{
case CAM_STATUS_START:
break;
case CAM_STATUS_FRAME:
camera_app_OnPreview(pMe);
break;
case CAM_STATUS_DONE:
ICAMERA_Release(pMe->pICamera);
break;
case CAM_STATUS_FAIL:
case CAM_STATUS_ABORT:
break;
}

int camera_app_InitializeCamera(camera_app *pMe)
{
int result = SUCCESS;
AEESize size;
result = ISHELL_CreateInstance(pMe->Applet.m_pIShell, AEECLSID_CAMERA, (void **)&(pMe->pICamera));
if(result)
return result;
if (result == SUCCESS)
{
result = ICAMERA_RegisterNotify(pMe->pICamera, camera_app_OnCamera, pMe);
size.cx = 240;
size.cy = 320;
ICAMERA_SetDisplaySize(pMe->pICamera, &size);
}
else {
pMe->pICamera = NULL;
}
return result;

int camera_app_StopCamera(camera_app *pMe)
{
return ICAMERA_Stop(pMe->pICamera);

int camera_app_PreviewCamera(camera_app *pMe)
{
return ICAMERA_Preview(pMe->pICamera);

void camera_app_OnPreview(camera_app *pMe)
{
int result = SUCCESS;
IBitmap *bitmap;
result = ICAMERA_GetFrame(pMe->pICamera, &bitmap);
if (result != SUCCESS) {
return;
}
IDISPLAY_BitBlt(pMe->pIDisplay, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen, bitmap, 0, 0, AEE_RO_COPY);
IDISPLAY_Update(pMe->pIDisplay);
IBITMAP_Release(bitmap);

void camera_app_OnKey(camera_app *pMe, uint16 key)
{
switch (key) {
case AVK_0:
case AVK_POWER:
ISHELL_CloseApplet(pMe->pIShell, FALSE);
break;
}

And the MIF file have privileges for AEEPRIVID_PLFILE
,but how to edit AEECLSID_CAMERA?
include "camera_app.bid"
AEEPRIVID_PLFile = 0x0001 --Declare
ModRsc {
id = 20, -- Applet base resource id
type = 1, --RESTYPE_ENCSTRING (see AEEResType.h)
data = EncStringRscData(0xff, "camera_app")

ModRsc {
id = 21,
type = 6, --RESTYPE_MIMETYPED (see AEEResType.h)
data = ImageRscData("image/png", BytesOfFile("camera_app_ico.png"))
{migrat
forumcommentstring}Applet {
appletid = AEECLSID_CAMERA_APP,
resbaseid = 20, -- Applet base resource id
applethostid = 0,
type = 0,
privs = {AEEPRIVID_PLFile},

Please let me know what I need to do.
Thanks.

I'm getting the error EPRIVLEVEL in ISHELL_CreateInstance.
coding given below:
/*=============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================*/
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEECamera.h" // Camera interface definitions
#include "camera_app.bid"
#include "camera_app_res.h"
/*=============================================================================
Applet structure. All variables in here are referenced via "pMe->"
=============================================================================*/
// Create an applet structure that's passed around. All variables in
// here will be able to be referenced as static.
typedef struct _camera_app {
AEEApplet Applet; // First element of this structure must be AEEApplet
AEEDeviceInfo DeviceInfo;// Always have access to the hardware device info
IDisplay *pIDisplay; // Give a standard way to access the Display interface
IShell *pIShell; // Give a standard way to access the Shell interface
int nWidth; // Stores the device screen width
int nHeight; // Stores the device screen height
// Add your own variables here...
ICamera *pICamera;
camera_app;
/*=============================================================================
Function Prototypes
=============================================================================*/
static boolean camera_app_HandleEvent(camera_app* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam);
boolean camera_app_InitAppData(camera_app* pMe);
void camera_app_FreeAppData(camera_app* pMe);
void camera_app_OnCamera(void *pUser, AEECameraNotify *pNotify);
int camera_app_InitializeCamera(camera_app *pMe);
int camera_app_StopCamera(camera_app *pMe);
int camera_app_PreviewCamera(camera_app *pMe);
void camera_app_OnPreview(camera_app *pMe);
void camera_app_OnKey(camera_app *pMe, uint16 key);
/*=============================================================================
FUNCTION DEFINITIONS
=============================================================================*/
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po,
void **ppObj)
{
*ppObj = NULL;
if( AEECLSID_CAMERA_APP == ClsId ) {
// Create the applet and make room for the applet structure
if( TRUE == AEEApplet_New(sizeof(camera_app),
ClsId,
pIShell,
po,
(IApplet**)ppObj,
(AEEHANDLER)camera_app_HandleEvent,
(PFNFREEAPPDATA)camera_app_FreeAppData) ) {
// FreeAppData is called after sending EVT_APP_STOP to HandleEvent
// Initialize applet data, this is called before sending
// EVT_APP_START to the HandleEvent function
if(TRUE == camera_app_InitAppData(
(camera_app*)*ppObj)) {
// Data initialized successfully
return(AEE_SUCCESS);
}
else {
// Release the applet. This will free the memory allocated for
// the applet when AEEApplet_New was called.
IApplet_Release((IApplet*)*ppObj);
return (EFAILED);
}
} // End AEEApplet_New
}
return(EFAILED);

static boolean camera_app_HandleEvent(camera_app* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode) {
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
camera_app_InitializeCamera(pMe);
camera_app_PreviewCamera(pMe);
return(TRUE);
// App is told it is exiting
case EVT_APP_STOP:
// Add your code here...
return(TRUE);
// App is being suspended
case EVT_APP_SUSPEND:
// Add your code here...
return(TRUE);
// App is being resumed
case EVT_APP_RESUME:
// Add your code here...
return(TRUE);
// An SMS message has arrived for this app.
// The Message is in the dwParam above as (char *).
// sender simply uses this format "//BREW:ClassId:Message",
// example //BREW:0x00000001:Hello World
case EVT_APP_MESSAGE:
// Add your code here...
return(TRUE);
// A key was pressed. Look at the wParam above to see which key was
// pressed. The key codes are in AEEVCodes.h. Example "AVK_1" means
// that the "1" key was pressed.
case EVT_KEY:
// Add your code here....
camera_app_OnKey(pMe, wParam);
return(TRUE);
// Clamshell has opened/closed
// wParam = TRUE if open, FALSE if closed
case EVT_FLIP:
// Add your code here...
return(TRUE);
// Clamtype device is closed and reexposed when opened, and LCD
// is blocked, or keys are locked by software.
// wParam = TRUE if keygaurd is on
case EVT_KEYGUARD:
// Add your code here...
return (TRUE);
// If nothing fits up to this point then we'll just break out
default:
break;
}
return (FALSE);

// This function is called when your application is starting up
boolean camera_app_InitAppData(camera_app* pMe)
{
// Get the device information for this handset.
// Reference all the data by looking at the pMe->DeviceInfo structure
// Check the API reference guide for all the handy device info you can get
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->Applet.m_pIShell,&pMe->DeviceInfo);
pMe->pIDisplay = pMe->Applet.m_pIDisplay;
pMe->pIShell = pMe->Applet.m_pIShell;
pMe->nWidth = pMe->DeviceInfo.cxScreen; // Cache width of device screen
pMe->nHeight = pMe->DeviceInfo.cyScreen; // Cache height of device screen
// Insert your code here for initializing or allocating resources...
pMe->pICamera = NULL;
// If there have been no failures up to this point then return success
return (TRUE);

// This function is called when your application is exiting
void camera_app_FreeAppData(camera_app* pMe)
{
// Insert your code here for freeing any resources you have allocated...
// Example to use for releasing each interface:
// if ( pMe->pIMenuCtl != NULL ) { // check for NULL first
// IMenuCtl_Release(pMe->pIMenuCtl)// release the interface
// pMe->pIMenuCtl = NULL; // set to NULL so no problems later
// }
//
camera_app_StopCamera(pMe);

void camera_app_OnCamera(void *pUser, AEECameraNotify *pNotify)
{
camera_app *pMe = (camera_app *)pUser;
switch (pNotify->nStatus)
{
case CAM_STATUS_START:
break;
case CAM_STATUS_FRAME:
camera_app_OnPreview(pMe);
break;
case CAM_STATUS_DONE:
ICAMERA_Release(pMe->pICamera);
break;
case CAM_STATUS_FAIL:
case CAM_STATUS_ABORT:
break;
}

int camera_app_InitializeCamera(camera_app *pMe)
{
int result = SUCCESS;
AEESize size;
result = ISHELL_CreateInstance(pMe->Applet.m_pIShell, AEECLSID_CAMERA, (void **)&(pMe->pICamera));
if(result)
return result;
if (result == SUCCESS)
{
result = ICAMERA_RegisterNotify(pMe->pICamera, camera_app_OnCamera, pMe);
size.cx = 240;
size.cy = 320;
ICAMERA_SetDisplaySize(pMe->pICamera, &size);
}
else {
pMe->pICamera = NULL;
}
return result;

int camera_app_StopCamera(camera_app *pMe)
{
return ICAMERA_Stop(pMe->pICamera);

int camera_app_PreviewCamera(camera_app *pMe)
{
return ICAMERA_Preview(pMe->pICamera);

void camera_app_OnPreview(camera_app *pMe)
{
int result = SUCCESS;
IBitmap *bitmap;
result = ICAMERA_GetFrame(pMe->pICamera, &bitmap);
if (result != SUCCESS) {
return;
}
IDISPLAY_BitBlt(pMe->pIDisplay, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen, bitmap, 0, 0, AEE_RO_COPY);
IDISPLAY_Update(pMe->pIDisplay);
IBITMAP_Release(bitmap);

void camera_app_OnKey(camera_app *pMe, uint16 key)
{
switch (key) {
case AVK_0:
case AVK_POWER:
ISHELL_CloseApplet(pMe->pIShell, FALSE);
break;
}

And the MIF file have privileges for AEEPRIVID_PLFILE
,but how to edit AEECLSID_CAMERA?
include "camera_app.bid"
AEEPRIVID_PLFile = 0x0001 --Declare
ModRsc {
id = 20, -- Applet base resource id
type = 1, --RESTYPE_ENCSTRING (see AEEResType.h)
data = EncStringRscData(0xff, "camera_app")

ModRsc {
id = 21,
type = 6, --RESTYPE_MIMETYPED (see AEEResType.h)
data = ImageRscData("image/png", BytesOfFile("camera_app_ico.png"))
{migrat
forumcommentstring}Applet {
appletid = AEECLSID_CAMERA_APP,
resbaseid = 20, -- Applet base resource id
applethostid = 0,
type = 0,
privs = {AEEPRIVID_PLFile},

Please let me know what I need to do.
Thanks.

The error was because you didn't have sufficient privilege.
To add AEECLSID_CAMERA, do the following:
Applet {
....
privs = {AEEPRIVID_PLFile, AEECLSID_CAMERA},

-Tony

The error was because you didn't have sufficient privilege.
To add AEECLSID_CAMERA, do the following:
Applet {
....
privs = {AEEPRIVID_PLFile, AEECLSID_CAMERA},

-Tony

But i can't find AEECLSID_CAMERA in the add new privileges dialog.
How to add AEECLSID_CAMERA in the Resource Manager window?
Thanks.

But i can't find AEECLSID_CAMERA in the add new privileges dialog.
How to add AEECLSID_CAMERA in the Resource Manager window?
Thanks.

Hi Tony,
Can you talk me How to add AEECLSID_CAMERA in the Resource Manager window ?
Thanks

Hi Tony,
Can you talk me How to add AEECLSID_CAMERA in the Resource Manager window ?
Thanks

Either switch to the source mode (the bottom left corner) in the Resource Manager or simply use any text editor to manually add AEECLSID_CAMERA to privs field of the Applet declaration in CIF.
-Tony

Either switch to the source mode (the bottom left corner) in the Resource Manager or simply use any text editor to manually add AEECLSID_CAMERA to privs field of the Applet declaration in CIF.
-Tony

I find it will return EFAILED in ISHELL_CreateInstance, when I add AEECLSID_CAMERA, do the following:
Applet {
....
privs = {AEEPRIVID_PLFile, AEECLSID_CAMERA},

What is the reason?

I find it will return EFAILED in ISHELL_CreateInstance, when I add AEECLSID_CAMERA, do the following:
Applet {
....
privs = {AEEPRIVID_PLFile, AEECLSID_CAMERA},

What is the reason?

are you sure you have a "direct show" compliant web cam attached to the computer?
-Tony

are you sure you have a "direct show" compliant web cam attached to the computer?
-Tony

Dear Tony,
Thanks for your reply and it's works.
Dear langziwuqing,
You can use sample code given above,and add
ICAMERA_SetSize(pMe->pICamera, &size) below
ICAMERA_SetDisplaySize(pMe->pICamera, &size).

Dear Tony,
Thanks for your reply and it's works.
Dear langziwuqing,
You can use sample code given above,and add
ICAMERA_SetSize(pMe->pICamera, &size) below
ICAMERA_SetDisplaySize(pMe->pICamera, &size).

hi tony,i dont very clear about "direct show" compliant web cam,what about "direct show" meaning?

hi tony,i dont very clear about "direct show" compliant web cam,what about "direct show" meaning?

andy wrote:hi tony,i dont very clear about "direct show" compliant web cam,what about "direct show" meaning?
i have the same question with andy.
by the way,would you tell me where i can find CIF file please tonyl??
cuz i just know MIF file and mfx file have infomation before complie of mif file.
and take a look in mif file its have structure different your post before.
i used SDK 3,15 and tried to add ICAMERA support to my app by the way i read in forum qualcomm like that:
Quote:1. Open .mif file
2. Go to dependencies tab
3. Check External Class Directory
4. Give you BREW SDK\inc directory path
5. Select 0x01002013 - CAMERA1 click add and save the mif file
but i can not find 0x01002013 - CAMERA1 in list.
anybody find solution please help me.
Rgs
quocvietit

andy wrote:hi tony,i dont very clear about "direct show" compliant web cam,what about "direct show" meaning?
i have the same question with andy.
by the way,would you tell me where i can find CIF file please tonyl??
cuz i just know MIF file and mfx file have infomation before complie of mif file.
and take a look in mif file its have structure different your post before.
i used SDK 3,15 and tried to add ICAMERA support to my app by the way i read in forum qualcomm like that:
Quote:1. Open .mif file
2. Go to dependencies tab
3. Check External Class Directory
4. Give you BREW SDK\inc directory path
5. Select 0x01002013 - CAMERA1 click add and save the mif file
but i can not find 0x01002013 - CAMERA1 in list.
anybody find solution please help me.
Rgs
quocvietit

Quote:1. Open .mif file
2. Go to dependencies tab
3. Check External Class Directory
4. Give you BREW SDK\inc directory path
5. Select 0x01002013 - CAMERA1 click add and save the mif file
my mistake because have tow "\inc" that reason make confuse.
now i can simulate camera decive in Brew.
anyway thanks you.

Quote:1. Open .mif file
2. Go to dependencies tab
3. Check External Class Directory
4. Give you BREW SDK\inc directory path
5. Select 0x01002013 - CAMERA1 click add and save the mif file
my mistake because have tow "\inc" that reason make confuse.
now i can simulate camera decive in Brew.
anyway thanks you.