nokia file system | developer.brewmp.com nokia file system | developer.brewmp.com

Developer

nokia file system

Forums:

All right, how are you guys doing? I´m a little (a lot, actually) frustrated with nokia (6225) file system.... here´s my problem:

I download an image of 20Kb and when I load it, it works allrigt, but when I try to show it, the application will show a White Screen, where the image was suposed to be. then I go to a diferent form and come back to the Image Form and the image is shown properly.... the BIGGEST problem is: sometimes it DOES work allright, and some random time DOESN´T, and it´s absolutely random, there´s no way to reperoduce the error.... );

The nokia file system doesn´t write the file imediately after the download, so I tryed a delay (around 3 secs) and istill doesn´t work....

any of you had this problem?? How can I make it work EVERY TIME??

Tnks a lot

Hi,
to show the downloaded picture you don`t need to write it to the filesystem. You can load it directly.
However you should use IIMAGE_Notify(when loaded from file too)to be sure that the image was successfully loaded. That is important if you load jpg files.
Example for loading image from Buffer:
bool CImage::CreateFromBuffer(const CString& type, const void* buf, int size)
{
Destroy();
applet_data* app=GETAPPLET();
transparence=false;
app->stat->img_state=IMG_LOADING;
boolean m_needsSysFree=false;
if (ISHELL_CreateInstance(app->applet.m_pIShell, AEECLSID_MEMASTREAM, (void **)(&app->pMemStream)) == SUCCESS)
{
int img_id;
if (type=="png")
img_id=AEECLSID_PNG;
else
img_id=AEECLSID_JPEG;
if(ISHELL_CreateInstance(app->applet.m_pIShell, img_id, (void **)(&m_image)) != SUCCESS)
{
IMEMASTREAM_Release(app->pMemStream);
app->stat->img_state=IMG_ERROR;
return false;
}
IMEMASTREAM_Set(app->pMemStream, (byte*)buf, size, 0, 0);
IIMAGE_SetStream(m_image, (IAStream*)app->pMemStream);
if (m_image==NULL)
{
IMEMASTREAM_Release(app->pMemStream);
app->stat->img_state=IMG_ERROR;
return false;
}
else
{
app->stat->img_count++;
IIMAGE_Notify(m_image, &ImageCallback, this);
IIMAGE_GetInfo(m_image, &m_imgInfo);
}
}
else
{
app->stat->img_state=IMG_ERROR;
return false;
}
return true;

You need to implement the ImageCallback function.
I hope that will help.
Best of luck.

Hi,
to show the downloaded picture you don`t need to write it to the filesystem. You can load it directly.
However you should use IIMAGE_Notify(when loaded from file too)to be sure that the image was successfully loaded. That is important if you load jpg files.
Example for loading image from Buffer:
bool CImage::CreateFromBuffer(const CString& type, const void* buf, int size)
{
Destroy();
applet_data* app=GETAPPLET();
transparence=false;
app->stat->img_state=IMG_LOADING;
boolean m_needsSysFree=false;
if (ISHELL_CreateInstance(app->applet.m_pIShell, AEECLSID_MEMASTREAM, (void **)(&app->pMemStream)) == SUCCESS)
{
int img_id;
if (type=="png")
img_id=AEECLSID_PNG;
else
img_id=AEECLSID_JPEG;
if(ISHELL_CreateInstance(app->applet.m_pIShell, img_id, (void **)(&m_image)) != SUCCESS)
{
IMEMASTREAM_Release(app->pMemStream);
app->stat->img_state=IMG_ERROR;
return false;
}
IMEMASTREAM_Set(app->pMemStream, (byte*)buf, size, 0, 0);
IIMAGE_SetStream(m_image, (IAStream*)app->pMemStream);
if (m_image==NULL)
{
IMEMASTREAM_Release(app->pMemStream);
app->stat->img_state=IMG_ERROR;
return false;
}
else
{
app->stat->img_count++;
IIMAGE_Notify(m_image, &ImageCallback, this);
IIMAGE_GetInfo(m_image, &m_imgInfo);
}
}
else
{
app->stat->img_state=IMG_ERROR;
return false;
}
return true;

You need to implement the ImageCallback function.
I hope that will help.
Best of luck.

All right, I don´t need to write it to the filesystem but I´m going to do cache of these images to use it later, so I don´t have to download it every single time...
The average will be 3 downloads of images on my aplication, and if I cache it will be much easyer, that´s why I need to write to the filesystem.... );
The best solution for me would be... download, write to filesystem, load and show...
any other sugestion??
Thanks a lot!

All right, I don´t need to write it to the filesystem but I´m going to do cache of these images to use it later, so I don´t have to download it every single time...
The average will be 3 downloads of images on my aplication, and if I cache it will be much easyer, that´s why I need to write to the filesystem.... );
The best solution for me would be... download, write to filesystem, load and show...
any other sugestion??
Thanks a lot!