MemoURL Database specification (english)

[MemoURL]

MemoURL for Palm Database specification (for Palmware Developer)


2002/04/23



AMsoft / amonsoft@hotmail.com 



Your Palmware is connected indirectly with WEB by MemoURL.

Most newest MemoURL is here.

About MemoURL is here.

1. Cooperation of MemoURL and Palmware

2. Specification of MemoURL Bookmark Database

3. Sample code


1. Cooperation of MemoURL and Palmware

The general usage of MemoURL is two of 、s which open URL whose note was made and which carry out WORD reference to reference sites, such as Google. Cooperation with a WEB site is simply attained by registering and various URL.
For example, it becomes possible to register easily into a WEB site the high score currently recorded on the game software on PalmOS in the following procedures.

  • Create CGI site which registers a high score by URL access.
  • At your Palmware, add URL which registers highscore to MemoURL bookmark database.
    (The example of URL)http://amsoft.co.jp/game.cgi?score=20430&name=amsoft )
  • A Palm user performs HotSync.
  • If MemoURL conduit is installed to desktop PC, the above-mentioned URL will be performed and a high score will be registered to site.



    MemoURL conduit perfomrs URL by HotSync.

    You need to add function which regist highscore to MemoURL database to existing palmware.

    The function which opens URL in texts, such as writing to a bulletin board and mail, other than the above-mentioned example to open URL registered into the address book can also be added.




    The easiest usage is the writing to the bulletin board of a Palmware writer site.

    There may be how to use many things otherwise.



  • 2. Specification of MemoURL Bookmark Database

    O Specification

    CreaterID  asUR

    DB名  asDB_URL

    DBType  Data


    * record data Specification

    Field type size(byte) Meaning
    Key Short 2 Arbitrary numerical values (although it was used before, since it is not used now, please put in (Short)0.)
    IsOpen Short 2 Open flag. 0:do nothing, 1:open url once and become 0, 2:open url every time
    URL Char 256 URL. Set 0 to URL field after URL data.
    PageTitle Char 128 Page(Site)Name. Set 0 to PageTitle filed after PageTitle data.


    * notes

  • Record size is fixed.
  • It OKs, even if URL and PageTitle overlap.
  • URL and PageTitle are an empty character ("") is also OKed.

  • 3. Sample code

    * Sample

    This is sample code how to regist URL to MemoURL bookmark database.


    Sorry for comment is few.

    If you have questions, mail to here.

    (Develop enviroment:Codewarrior7J)



    // define

    #define appFileCreator 'asUR'

    #define appVersionNum 0x01

    #define appPrefID 0x00

    #define appPrefVersionNum 0x01

    #define AppType 'appl'

    #define DBType 'Data'

    //#define DBType 'asUR'

    #define MEMOURL_DBNAME "asDB_URL"

    #define MEMOURL_DB_MAX 255

    #define TITLE_LEN 128

    #define URL_LEN 256

    #define OPENTYPE_NONE 0

    #define OPENTYPE_ONCE 1

    #define OPENTYPE_EVERY 2




    // struct bookmark database

    typedef struct {

    short key;

    short openType;

    char url[URL_LEN];

    char title[TITLE_LEN];

    } BookmarkRec;



    /***********************************************************************



    add bookmark function

    err transaction is Abbreviationed.



    ***********************************************************************/

    void AddBookmark()

    {

    BookmarkRec bookmark;

    UInt recordSize, index, offset;

    short openType = 1;

    VoidHand recHdl;

    VoidPtr recPtr;

    DmOpenRef gdbUrl = 0;

    gdbUrl = DmOpenDatabaseByTypeCreator( DBType, appFileCreator, dmModeReadWrite );

    index = DmNumRecords(gdbUrl);

    recHdl = DmNewRecord(gdbUrl, &index, recordSize);// Reserve new record

    SetBookmark(&bookmark, 0, OPENTYPE_ONCE, "http://amsoft.co.jp/game.cgi?name=ams", "Regist HISCORE");

    recordSize = sizeof(bookmark);

    if( recHdl ){

    // add record

    recPtr = MemHandleLock(recHdl);

    DmSet( recPtr, 0, recordSize, 0);

    offset = 0;

    DmWrite(recPtr, offset, &bookmark, sizeof(bookmark));

    MemHandleUnlock(recHdl);

    DmReleaseRecord(gdbUrl, index, true);

    } else {

    // error

    }



    DmCloseDatabase( gdbUrl );

    }




    /***********************************************************************



    init BookmarkRec struct function



    ***********************************************************************/

    Boolean InitBookmark(BookmarkRec *pBookmarkRec){

    Err err;



    pBookmarkRec->key = 0;

    pBookmarkRec->openType = 0;

    err = MemSet(pBookmarkRec->url, sizeof(pBookmarkRec->url), 0);

    if( err )

    return false;

    err = MemSet(pBookmarkRec->title, sizeof(pBookmarkRec->title), 0);

    if( err )

    return false;

    return true;

    }




    /***********************************************************************



    set parameter to BookmarkRec struct function



    ***********************************************************************/

    Boolean SetBookmark(BookmarkRec *pBookmarkRec, short key, short openType, char *pUrl, char *pTitle){

    Word len;



    InitBookmark(pBookmarkRec);

    pBookmarkRec->key = key;

    pBookmarkRec->openType = openType;

    len = StrLen(pUrl);

    if( len > URL_LEN )

    len = URL_LEN;

    StrNCopy(pBookmarkRec->url, pUrl, len);

    len = StrLen(pTitle);

    if( len > TITLE_LEN )

    len = TITLE_LEN;

    StrNCopy(pBookmarkRec->title, pTitle, len);



    return true;

    }





    MemoURL was developed by Codewarrior7J.

    If you use NSBasic etc, you can use MemoURL bookmark database by same method.

    <!-- text below generated by server. PLEASE REMOVE -->


    1