40
The Mobility Project Alex Luddy

The Mobility Project

Embed Size (px)

DESCRIPTION

The Qt Mobility project is developing new Qt APIs. These APIs will benefit all Qt developers. This presentation shall provide an overview of the APIs and demonstrate the use of some the APIs through an example application. This presentation shall fuel ideas for usage of the new APIs in your own projects. Presentation by Alex Luddy held during Qt Developer Days 2009. http://qt.nokia.com/developer/learning/elearning

Citation preview

Page 1: The Mobility Project

The Mobility ProjectAlex Luddy

Page 2: The Mobility Project

Purpose

• Fuel your ideas for using the Qt APIs from the

Mobility project

1

Page 3: The Mobility Project

Agenda

• Background

• Content Overview

– Some examples

• Questions

2

Page 4: The Mobility Project

Traditional Qt

3

Page 5: The Mobility Project

Qt Going Forward

4

Page 6: The Mobility Project

Mobility Project

5

Page 7: The Mobility Project

Mobility and Applications

6

Page 8: The Mobility Project

Qt Mobility Details

• The Mobility project is creating Qt APIs

• APIs will have supported functional back-ends on

all platforms where it makes sense

• Some APIs on Qt labs now

7

Page 9: The Mobility Project

The Story of Bob the Developer

• Wants to make a mobile application

• Wants the application to be cross-platform

• A Web feed reader…

8

Page 10: The Mobility Project

Bearer Management

• Enables roaming between

connections

• Choose most appropriate

connection

• Manage connections

9

Page 11: The Mobility Project

Bearer Management

10

Page 12: The Mobility Project

Bearer Management Demo

11

Page 13: The Mobility Project

Bearer Management Example

class BearerCloud : public QGraphicsScene

{

// ...

QNetworkConfigurationManager manager;

};

12

Page 14: The Mobility Project

Bearer Management Example

connect(&manager,

SIGNAL(configurationAdded(QNetworkConfiguration)),

this, SLOT(configurationAdded(QNetworkConfiguration)));

connect(&manager,

SIGNAL(configurationUpdated(QNetworkConfiguration)),

this, SLOT(configurationUpdated(QNetworkConfiguration)));

13

Page 15: The Mobility Project

Bearer Management Example

void BearerCloud::configurationAdded(

const QNetworkConfiguration& configuration)

{

const QNetworkConfiguration::StateFlags state =

config.state();

// position in cloud based on state

}

14

Page 16: The Mobility Project

Back to Bob

• Efficient Internet connection

• Web feed reader with contact interest

information…

15

Page 17: The Mobility Project

Contacts

• Work with contact data

• Add custom data

• Introspect contact data

• Enumerate contact stores

– Local and remote

16

Page 18: The Mobility Project

Contacts

17

Page 19: The Mobility Project

Contacts Example: Show Contacts

// prepare fetch request

QContactManager* manager = new QContactManager();

QContactFetchRequest* fetchRequest = new QContactFetchRequest;

fetchRequest->setManager(manager);

connect(fetchRequest,

SIGNAL(progress(QContactFetchRequest*,bool)), this,

SLOT(showContacts(QContactFetchRequest*,bool)));

m_fetchRequest->start()

18

Page 20: The Mobility Project

Contacts Example: Show Contacts

void Example::showContacts(QContactFetchRequest* request,

bool appendOnly)

{

QList<QContact> results = request->contacts();

// handle append only case

// access contacts for display

for (int i = 0; i < results.size(); ++i) {

QString display = results[i].displayLabel().label();

// ...

19

Page 21: The Mobility Project

Back to Bob

• Efficient Internet connection

• Access contact details

– Add “interest” as custom data

• Web feed reader that can send messages to

contacts about relevant information..

20

Page 22: The Mobility Project

Messaging

• Send (Email, SMS, MMS)

• Work with stored/remote messages

• Access message accounts

• New message notifications

• Retrieve

21

Page 23: The Mobility Project

Messaging

22

Page 24: The Mobility Project

Messaging Example: Send Message

// get to address

QString to =

contact.detail<QContactEmailAddress>().emailAddress();

// prepare message

QMessage message;

message.setType(QMessage::Email);message.setTo(QMessageAddress(to, QMessageAddress::Email));message.setSubject(“Boating”);message.setBody(“Here is a link you might like...”);

23

Page 25: The Mobility Project

Messaging Example: Send Message

// send

QMessageServiceAction service;

connect(&service, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(stateChanged(QMessageServiceAction::State)));

service.sendMessage(message);

// check send result

void MessageSender::stateChanged(QMessageServiceAction::State state)

{if (state == QMessageServiceAction::Successful)

// all good

24

Page 26: The Mobility Project

Back to Bob

• Efficient Internet connection

• Access contact details

• Send messages to contacts

• The “I am going to be late”

application…

25

Page 27: The Mobility Project

Location

• Where am I?

– Stream location data

• Be notified when within range of a

location

• Underlying location technology

agnostic

26

Page 28: The Mobility Project

Location

27

Page 29: The Mobility Project

Location Demo

28

Page 30: The Mobility Project

Location Example

// create source

source = new QNmeaPositionInfoSource(

QNmeaPositionInfoSource::SimulationMode, this);

// open NMEA data file and set as device for source

source->setUpdateInterval(1500);

connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),

this, SLOT(positionUpdated(QGeoPositionInfo)));

29

Page 31: The Mobility Project

Location Example

void MapWindow::positionUpdated(const QGeoPositionInfo& info)

{

if (info.hasProperty(QGeoPositionInfo::Heading))

// ...

QString url = /* ... */

.arg(QString::number(

info.coordinate().latitude()))

// ...

30

Page 32: The Mobility Project

Back to Bob

• Efficient use of network

• Accessing contact details

• Sending messages to contacts

• Knows where user is

31

Page 33: The Mobility Project

Other APIs for Application Developers

• Multimedia

• System Information

• Calendar (coming next year)

• Sensors (coming next year)

• More to come…

32

Page 34: The Mobility Project

System Developer APIs

• Use case is focused more on development of a

system rather than an application

• Publish and subscribe

• Service framework

33

Page 35: The Mobility Project

Publish and Subscribe

• Unifies various sources of hierarchical data into a

single consistent model

• Uses QVariant

/Device/Buttons = 3

/Device/Buttons/1/Name = Context

/Device/Buttons/1/Usable = true

/Device/Buttons/2/Name = Select

34

Page 36: The Mobility Project

Service Framework

• Discover and work with

services

• Central service registry

• XML definition

• Out-of-process support

coming next year

35

Page 37: The Mobility Project

Service Framework

36

Page 38: The Mobility Project

Content Summary

• Bearer Management, Contacts, Messaging,

Location, Multimedia, System Information,

Publish and Subscribe, Service Framework

• …

37

Page 39: The Mobility Project

Summary

• Rich cross-platform applications

• Qt brilliant developer offering everywhere

38

Page 40: The Mobility Project

Questions

• http://labs.qt.nokia.com/page/Projects/QtMobility

• All API feedback appreciated

39