Page 1 of 2 12 LastLast
Results 1 to 20 of 32
  1. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #1  
    Hello out there,
    I'm doing some research on SMS and call duration counting. Therefore I need to access two tables of /var/luna/data/dbdata/PalmDatabase.db3.
    How can this be achieved from within a webOS-App? Any help or Link would be appreciated.

    I've written a litte shell-script to count the sent SMS since a defined timstamp, just fyi:

    Code:
    stamp=$(date +%s 2009-11-09-00:00)000
    cmd='select * from com_palm_pim_FolderEntry where timeStamp>'$stamp' and smsClass='0' and messageType='\''SMS'\'';'
    output=$(echo "$cmd"|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3)
    echo "** SMS since stamp:"
    echo "$output" | wc -l
    Thats what I want to pack in a nice GUI, but I don't know how to access this db? Thank you very much,
    Tobias
  2. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #2  
    this is what i have been loooking into. you can use html5 to open a database and execute select statements then you can perform operations on the resultant array.
  3. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #3  
    Thank you for this hint!
    I had a look at the Data-Sample that came with the SDK, but I am still unable to open /var/luna/data/dbdata/PalmDatabase.db3.
    I made all my changes to the sample application, i.e. I changed the database and the query:

    Code:
    ...
    this.db = "/var/luna/data/dbdata/PalmDatabase.db3";
    .
    .
    .
    .
    QueryAssistant.prototype.activate = function(event) {
    	/* put in event handlers here that should only be in effect when this scene is active. For
    	   example, key handlers that are observing the document */
    	
    	// Query table1
    	var mytext = 'select * from com_palm_pim_FolderEntry;' //'select * from table1;'
        this.db.transaction( 
            (function (transaction) { 
                transaction.executeSql(mytext, [], this.queryDataHandler.bind(this), this.errorHandler.bind(this)); 
            }).bind(this) 
        );
    }
    But i can't see any results in the sample app, though queries are similar to the queries in the example.
    Is there an error in my this.db-path?
    Thank you,
    Tobias
  4. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #4  
    We might need to pool our efforts.

    I used SQLMan to export records from the PalmDatabase.db3 file....from the following tables....

    com.palm.messaging.data.chatthread
    com.palm.pim.folderentry
    com.palm.pim.memos
    com.palm.pim.task
    com.palm.pim.tasklist, and
    com.palm.superlog.superlog

    I then tried to import them into a 1.3.1 PalmDatabase.db3 file

    The formatting was messed up though. I couldn't fix and gave up. I didn't try this method though.

    This might have better success... pull entire tables out and put them into a temp database and push them to a new database on a new phone with a differing webos version.

    Lets chat.

    drewp9@yahoo.com
  5. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #5  
    FTR, you handle the result array in the function.... this.queryDataHandler.bind(this)

    The example has this datahandler function set up already. There is some fluff in it that you can do without...but start there.
  6. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #6  
    I found this at the official palm forums (search for PalmDatabase.db3 there):

    There's no way for a javascript application to open the PalmDatabase.db3 file. You can only access some of the data within it using service requests (such as the contacts or the calendar services).
    Very, very sad. So I'm stuck with my shell script, not very luna-ish
  7. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #7  
    has your testing supported this? Were you able to get any resultant arrays out of your queries?
  8. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #8  
    Yes, my testing clearly supported this. I couldn't get any results when using a filesystem-path to the database
    On a shell script, everything works like a charm, but unfortunately without a fancy frontend.
    Found some service from PreGame that enables normal apps to execute shell commands, but couldn't find anything if this service returns results from the commands that were executed. If that service returned any values, we had a workaround for the SDK not being able to open PalmDatabase.db3.
  9. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #9  
    I have a service also, but mine does not return any values either.

    Where did you say you found the quote on the PalmDatabase.db3 file being inaccessible?
  10. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #10  
    Hello DrewPre, I found that information at
    hXXp://developer.palm.c0m/distribution/viewtopic.php?f=16&t=2704&p=9993&hilit=PalmDatabase.db&sid=05928394a75d3dfee6c81b70fde4ce82#p9993 (sorry, not allowed to post links yet).
    My second idea was, that the shell scripts could write their return values into a textfile e.g. in /var/log and the Javascript-app could read the files - but I can't find a way to read textfiles either
  11. ird
    ird is offline
    ird's Avatar
    Posts
    156 Posts
    Global Posts
    167 Global Posts
    #11  
    Your best bet is to write a service\plugin that gets the info you need, and then use it to get the information to your app.

    This could help you get started.
  12. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #12  
    Thanks for your hint!
    So all in all it would probably be the most universal solution to have a service, which executes shell scripts and additinally passes the output values of the shellscript back to the normal application. Oh my god, that is going to be more difficult than I expected 8-)
  13. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #13  
    I found the following in /usr/palm/applications/com.palm.app.phone/app/controllers/incomingcall-assistant.jsjsjs

    Code:
    this.lastAddRequest = new Mojo.Service.Request("palm://com.palm.superlog", {
    	method: 'addEntry', 
    	parameters: {	
    		contactId: contactId,
    		"displayName":displayName,
    		number: number,
    		type: type,
    		startTime: startTime,
    		duration: duration,
    		"pictureLoc": picLoc,
    		label:label
    	},
    	onSuccess: this.repostLog.bind(this),
    	onFailure: function() {
    	QDLogger.error( "CallLogList#addEntry", "unable to write call log entry");
    	}
    });
    Clearly this is using the addEntry method to write to the PalmDatabase.db3 file through the com.palm.superlog service.

    I dug a little further and found services for Tasks, Notes[memos], messages and contacts.

    Implicitly, if you can write to the database with a service call you can also read from it. Let me dig a little more and see if Ican't find the supported methods.
  14. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #14  
    notes ==> /usr/share/dbus-1/system-services/com.palm.notes.service
    tasks ==> /usr/share/dbus-1/system-services/com.palm.tasks.service
    calllogs ==> /usr/share/dbus-1/system-services/com.palm.superlog.service
    messages ==> /usr/share/dbus-1/system-services/com.palm.messaging.service
    contacts ==> /usr/share/dbus-1/system-services/com.palm.contacts.service

    The Superlog service appears to ahve the following methods....

    logQuery
    logCount
    deleteEntry
    deleteAll
    addEntry

    The Notes service appears to have the following methods....

    saveNote
    getNote
    deleteNote
    getNotes

    The tasks service appears to have the following methods...

    getTaskList
    moveTask
    moveTaskList
    markTasksCompleted
    markTasksIncomplete
    setTasksDueDate
    updateDueItems
    getTaskListPositionIndex
    Last edited by DrewPre; 12/08/2009 at 01:37 AM.
  15. Kaerey's Avatar
    Posts
    539 Posts
    Global Posts
    540 Global Posts
    #15  
    You may also want to look through webos-internals for something called DB Dump it's a script that dumps all databases in webOS into html tables. We used it to initially find the location of the preference for notification and alert tones.
    8MB Visor --> Treo 300 --> Treo 650 --> Treo 800w --> Palm Pre
    All devices obtained within first week of launch
  16. TBH
    TBH is offline
    TBH's Avatar
    Posts
    47 Posts
       #16  
    Kaerey, great script, thanks for the hint!

    DrewPre, this is great news! If I have a look at the names, logQuery seems to be the method we need? I'm not sure how to test this further on as I don't have a clue how you found out that this methods were included in the superlog service ;-) If I can do any testing in the SDK, tell me and I'll do it
  17. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #17  
    The SDK doesn't provide information on these services. At least I am sifting thru them now and haven't found anything. But you could issue the following command from the shell....

    luna-send -n 1 palm://com.palm.superlog/logQuery {}

    That won't work as you have to specify parameters... The format of the parameters is tricky and I haven't figured it out yet.

    As for the methods, you'll need a java class editor to get a list of methods in each service. WinRar will extract the jar files and the class editor will view the methods in the *.class file
  18. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #18  
    luna-send -n 1 palm://com.palm.notes/getNotes {} worx from the shell and lists the memos in the memos app. Probably because I am logged in as Root

    However,

    when I tried to implement that same serviceRequest in a sample webOS Application, i got the following....

    2009-12-07T08:33:58.523871Z [50538] qemux86 user.crit LunaSysMgr: {LunaSysMgrJS}: com.tntservices.scratchpad: Error: Error: service request: Permission Denied, file:///var/usr/palm/applications/com.tntservices.scratchpad/index.html:0
    looks like this is not going to work.
  19. Daemon's Avatar
    Posts
    796 Posts
    Global Posts
    809 Global Posts
    #19  
    What you're trying to do fundamentally violates the security model of WebOS.
    You can't access some other app's data or files directly using anything in the
    Mojo SDK which means no WebOS app can access the palm databases directly.
    You can't call shell scripts from WebOS apps, period.
    Services (written in Java or C) are meant to be the interface between WebOS and the Pre's linux underpinnings.
    When others say to write a service to access the data, they
    don't mean write a service to call a shell script to access the data.
    That can be done but it also violates the security WebOS model and is an unsupported
    model. The old LED flashlight app did that and it's been since removed. What
    they mean is to write a background service which accesses the data directly
    through Java or C SDKs, and then exposes specific methods which can be called
    by WebOS apps.

    Examples of current services.
    GStreamer Service (used by PreRecorder)
    Package Manager Service (used by Preware)
    Accelerometer Service (used by various apps to speed up tilt sensor sample rate)
    FileMgr Service (used by Internalz)

    ian
  20. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #20  
    > Services (written in Java or C) are meant to be the interface between WebOS and the Pre's linux underpinnings.

    So I guess the question that is lingering in my mind, which was the motivation for me pursuing this alternative route, is... If a webOS App requires a service and that service meets the criteria you specified above [java or C service that accesses the data directly and exposes specific methods] can it be included in the Palm App Catalog?

    I have been going on the assumption that there are no App Catalog Apps that require and/or utilize services therefore I've been trying to figure out a way to avoid the use of a service.

    After all, all of the apps you mention above are NOT in the App Catalog, and if it's not going to be in the App Catalog, then why is it important not to 'fundamentally violate the security model of webOS'?
    Last edited by DrewPre; 12/07/2009 at 01:28 PM.
Page 1 of 2 12 LastLast

Posting Permissions