[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim]
From:       Helge Deller <deller () gmx ! de>
Date:       2003-04-21 18:09:42
[Download RAW message or body]

Hi all,.

I would like to start a universal "Mobile Devices Connection Kit",
which should make it easy for a lot of programs to access different
mobile devices through a universal and generic interface and enable
them to exchange any type of data through this interface.

As a few examples we currently have:
	- kitchensync has it's own type of different plugins e.g. to access qtopia (mobile \
                phone support not yet available)
	- korganizer hasn't any direct import/export functionality to/from an organizer or \
                mobile phone yet (IIRC)
	- kaddressbook has a gnokii import/export filter for NOKIA mobile phones only, other \
devices   like e.g. organizers are not supported yet.
	- most other applications are still lacking any mobile device import/export \
functionalities

The goal would be:
	- to support mobile phones, organizers, mp3 players, USB memory sticks and other \
                devices
	- not to duplicate work to write mobile class access functions specific for every \
                single application.
	- to use a well-defined interface to easily access different mobile device types
	- to make this interface flexible and extensible
	- to port existing interfaces (e.g. kio-rio, kitchensync/libkonnector2/*) over to \
this new interface

The idea:
	- write a universal/generic plugin system (e.g. "class KMobileDeviceManager")
	- for every mobile device write a access-driver based on a "KMobileDevice" class 
		(sample code example attached below),
	- modify the applications to use this plugin system, so that all types of mobile \
devices  will be supported.

Further ideas could be:
	- a kicker module. It would search regulary at the USB/IRDA/Bluetooth ports for new \
devices  and allow the user to configure the new device at once.
	- a kioslave (e.g. "mobile://") , which shows all configured devices.
		The root-directory would show an icon for each device (like a sub-directory), then \
in  each of those sub-directories you would see directories for each capatibility \
(Addressbook, Calendar,   Notes, Storage). The Addressbook could show vCard files, \
the calendar vCalendar files, and the  storage subdirectory would show the files on \
                the device.
	- a new kcontrol module to globally configure the attached mobile devices

Since my time in general is very limited, I definitively would need help from others \
on such a project. 
Personally I would like to start with an implementation with gnokii and gammu to 
make most mobile phones directly accessible.
If people don't complain, I would like to create the subdirectory kdepim/libkmobile
and put my initial work there.

What does people on this list think about such an idea ?

Helge


["kmobiledevice.h" (text/x-chdr)]

/* This file is part of the KDE libraries
    Copyright (C) 2003 Helge Deller <deller@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License version 2 as published by the Free Software Foundation.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.

*/

#ifndef kmobiledevice_h
#define kmobiledevice_h

#include <qstring.h>
#include <qstringlist.h>
#include <qbytearray.h>

#include <kabc/addressee.h>
#include <kabc/addresseelist.h>

#include <kio/global.h>

/**
 *  The base plugin class of all mobile devices. 
 */
class KMobileDevice : public QObject
{
Q_OBJECT
public:
    KMobileDevice(QObject *obj, const char *name );
    ~KMobileDevice();

    // connect, disconnect and current status
    virtual bool connectDevice();
    virtual bool disconnectDevice();
    virtual bool isConnected();

    // returns e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
    virtual QString deviceClassName();

    // returns real device name, e.g. "Nokia 6310" or "Rio MP3 Player"
    virtual QString deviceName();

    // returns e.g. "Revision 1.2"
    virtual QString revision();

    // returns true, if this device is only slowly accessible
    virtual bool isSlowDevice();

    // call a device-specific configure dialog
    virtual bool hasConfigDialog();
    virtual bool configDialog( QWidget *parent );

    // The ClassType may be used e.g. to select an suitable icon
    enum ClassType { 
	Phone = 1,
        Organizer = 2,
	MP3Player = 3,
    };
    void setClassType( enum ClassType ct ) { classType = ct; };
    enum ClassType classType()           { return classType; };

    // The capabilities of this device (bitmapped value)
    enum Capabilities {
	hasNothing     = 0,	// not supported
	hasAddressBook = 1,	// mobile phones, organizers, ...
	hasCalendar    = 2,	// organizers, mobile phones, ...
	hasNotes       = 4,	// organizers, mobile phones, ...
	hasFileStorage = 8,	// organizers, handhelds, mp3-player, ...
    };
    void setCapabilities( enum Capabilities c ) { caps = c; };
    enum Capabilities capabilities()         { return caps; };

    /*
     * Addressbook / Phonebook support
     */
    virtual int  numAddresses();
    virtual bool readAddress( int index, KABC::Addressee &adr );
    virtual bool storeAddress( int index, const KABC::Addressee &adr, bool append = \
false );  virtual bool readAllAddresses( KABC::AddresseeList &list );
    virtual bool storeAllAddresses( const KABC::AddresseeList &list, bool append = \
false );

    /*
     * Calendar support
     */
    // TODO: TBD
    virtual int  numCalendarEntries();
    virtual bool readCalendarEntry( int index, <type> &entry );
    virtual bool storeCalendarEntry( int index, <type> &entry );
    virtual bool readAllCalendarEntries( <type> &entryList );
    virtual bool storeAllCalendarEntries( <type> &entryList, bool append = false );

    /*
     * Notes support
     */
    virtual int  numNotes();
    virtual bool readNote( int index, QString &note );
    virtual bool storeNote( int index, const QString &note );
    virtual bool readAllNotes( int &cout, QStringList &list );
    virtual bool storeAllNotes( const QStringList &list, bool append = false );

    /*
     * File storage support
     * @param fileName  path and name of a file in the mobile device, e.g. \
                "/MYFILE.TXT", "/mp3/song1.mp3"
     */
    virtual KIO::Error listDir( const QString &fileName );

    virtual KIO::Error statFile( const QString &fileName, UDSEntry &entry );
    virtual KIO::Error deleteFile( const QString &fileName );

    virtual KIO::Error readFile( const QString &fileName, QByteArray &content );
    virtual KIO::Error storeFile( const QString &fileName, const QByteArray &content, \
const UDSEntry &entry );

    virtual KIO::Error mkDir( const QString &fileName, const UDSEntry &entry );
    virtual KIO::Error rmDir( const QString &fileName );


slots:
    // called whenever the connection status changes
    void slotConnectionChanged( bool connected );

    enum MsgLevel { info=0, warning=1, error=2 };
    void slotMessage( int msgLevel, const QString &msg );
    
signals:

protected:
    QString deviceName;		// e.g. "Nokia 6310", "Opie"
    QString connectionName;	// e.g. "IRDA", "USB", "Cable", "gnokii", "gammu", ...
    enum ClassType classType;
    enum Capabilities caps;

private:
    class KMobileDevicePrivate *d;
};

}
#endif



_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic