amora: a mobile remote assistant

34
1 © INdT 2007 | Company Confidential Amora: A mobile remote assistant Adenilson Cavalcanti Community Group – INdT (Nokia) [email protected] [email protected]

Upload: gsroma

Post on 19-May-2015

1.302 views

Category:

Technology


0 download

DESCRIPTION

Adenilson Cavalcanti

TRANSCRIPT

Page 1: Amora: A mobile remote assistant

1 © INdT 2007 | Company Confidential

Amora: A mobile remote assistant

Adenilson CavalcantiCommunity Group – INdT (Nokia)[email protected]@gmail.com

Page 2: Amora: A mobile remote assistant

2 © INdT 2007 | Company Confidential

Objectives

•Explain reasons for design/implementation of Amora

•Present tools used

•Share knowledge and lessons

Page 3: Amora: A mobile remote assistant

3 © INdT 2007 | Company Confidential

Why create Amora

Free/OSS 'remote controllers' @ 2007/06

•Abandoned, no longer maintained

•Unstable/bad performance

•Confusing user interface

•Windows only (or poor support for Linux)

•Almost impossible to install

Page 4: Amora: A mobile remote assistant

4 © INdT 2007 | Company Confidential

Project Size• 3342LOC (8 persons/month):

55% ANSI C, 37% Python, 8% C++• 3000 visits/month, 132 different

nations (november@2007)

Page 5: Amora: A mobile remote assistant

5 © INdT 2007 | Company Confidential

... do brazilians love python+amora?

september@2008

Page 6: Amora: A mobile remote assistant

6 © INdT 2007 | Company Confidential

Project

•GPL 2.0: free/opensource software•officially packaged: Mandriva, Fedora Core, Debian•code base is small•contributors are welcomewelcome

Webpage

http://amora.googlecode.com/

Repository

http://amora.googlecode.com/svn/trunk/

Page 7: Amora: A mobile remote assistant

7 © INdT 2007 | Company Confidential

Concept

A long way to go...

*The project was codenamed P4X (Presenter 4 X)

Page 8: Amora: A mobile remote assistant

8 © INdT 2007 | Company Confidential

Concept: design

A long way to go...

Page 9: Amora: A mobile remote assistant

9 © INdT 2007 | Company Confidential

Implementation

Coding can get messy!

Page 10: Amora: A mobile remote assistant

10 © INdT 2007 | Company Confidential

Implementation

“Programmers shalt not do user interface...”

Page 11: Amora: A mobile remote assistant

11 © INdT 2007 | Company Confidential

Implementation

Clear vision of where to go is important!

2.5 months

06/16

08/31 rev. 1861616 LOCs

spare time

Page 12: Amora: A mobile remote assistant

12 © INdT 2007 | Company Confidential

Today usability

Page 13: Amora: A mobile remote assistant

13 © INdT 2007 | Company Confidential

Architecture

Page 14: Amora: A mobile remote assistant

14 © INdT 2007 | Company Confidential

Amora lib

•ANSI C/POSIX: protocol + communication

•Xlib/XTest: window events (portable to other *nix)

•imlib: screenshot, resize, rotation

•BlueZ: communication

•D-BUS: dongle disconnection

Page 15: Amora: A mobile remote assistant

15 © INdT 2007 | Company Confidential

Amora library

Exec. Server size 25KB...

Page 16: Amora: A mobile remote assistant

16 © INdT 2007 | Company Confidential

UI applet

Page 17: Amora: A mobile remote assistant

17 © INdT 2007 | Company Confidential

Client

Classes

•Amora: main loop•Application: main application logic•Wallpaper: main app background image•Help: display help text•Bluetooth: communication•Keyboard: required to draw in Canvas

Page 18: Amora: A mobile remote assistant

18 © INdT 2007 | Company Confidential

Protocol

•Default log when connecting:[Apr 15 18:34:31]: Accepted connection. Client is

00:18:42:E3:EC:44

[Apr 15 18:34:31]: Read buffer = SCREEN_MODE_ON

[Apr 15 18:34:31]: Read buffer = SCREEN_RESOLUTION

[Apr 15 18:34:31]: Read buffer = 240

[Apr 15 18:34:31]: Read buffer = 320

•Protocol is:- set screenshot on or off- screen width- screen height

Page 19: Amora: A mobile remote assistant

19 © INdT 2007 | Company Confidential

Protocol

•Log for screenshot event:[Apr 15 18:39:17]: Read buffer = SCREEN_TAKE

•Protocol is:- set orientation (rotate or not)- client ask for screenshot (SCREEN_TAKE)- server answers with image size (56732)- server starts to write data in socket- client must read this data

Page 20: Amora: A mobile remote assistant

20 © INdT 2007 | Company Confidential

Screenshot client code

Page 21: Amora: A mobile remote assistant

21 © INdT 2007 | Company Confidential

Other protocol commands

Page 22: Amora: A mobile remote assistant

22 © INdT 2007 | Company Confidential

Why use Python for client side?

String tmp = new String("Hello, Java is cool!");

StringBuffer newer = new StringBuffer(tmp);

System.out.println(newer);

Symbian x Java x Python

_LIT(Scnst, “Welcome to darkness...”);

TBufC8<20> buffer(Scnst);

TBufC8<20> copy;

TPtr8 ptr = copy.Des();

ptr.Copy(buffer);

//Deprecated!

printf(“symbian string = %s\n”, ptr.PtrZ());

a = 'Python rulez!'; b = a; print b

Page 23: Amora: A mobile remote assistant

23 © INdT 2007 | Company Confidential

How many lines a simple 'hello world' has?

import appuifwappuifw.note(u'Hello!')

Symbian Java Python0

10

20

30

40

50

60

70

LOC por linguagem

LOC

Lin

es o

f C

ode

Page 24: Amora: A mobile remote assistant

24 © INdT 2007 | Company Confidential

Summing up: Python is fun!

Page 25: Amora: A mobile remote assistant

25 © INdT 2007 | Company Confidential

Tools

•logging: helped to track on missing call to XFlush();•electric fence: helped to find one memory leak in

logging functions;•gtk-devel-list: help for get real root window for

GTK apps;•valgrind: server can run fine inside it;•autotools: buildsystem help to support Linux

flavors;•doxygen: source code documentation;•subversion: today I would use git...•utest: help to optimize uloop code;

Page 26: Amora: A mobile remote assistant

26 © INdT 2007 | Company Confidential

BT terminal

•Script to create a terminalsdptool add --channel=1 SPsdptool browser localwhile true; do rfcomm listen /dev/rfcomm0 1; done

Page 27: Amora: A mobile remote assistant

27 © INdT 2007 | Company Confidential

BT terminal

Page 28: Amora: A mobile remote assistant

28 © INdT 2007 | Company Confidential

BT Terminal

Page 29: Amora: A mobile remote assistant

29 © INdT 2007 | Company Confidential

BT Terminal

Page 30: Amora: A mobile remote assistant

30 © INdT 2007 | Company Confidential

Help is welcome

•tablet amora: client for internet tablet•ports: Mac OSX, FreeBSD, Solaris (if at least it has a bluetooth stack...)

•j2me client: cover other cellphones models•Qt applet: needs some love•features: see project issues list

Page 31: Amora: A mobile remote assistant

31 © INdT 2007 | Company Confidential

What is next

• D-BUS integration

• Tamora (Tablet amora)

• Java client

Page 32: Amora: A mobile remote assistant

32 © INdT 2007 | Company Confidential

Acknowledgments

• INdT (Instituto Nokia de Tecnologia): for contributing to development of this project: hardware, some coding hours, travels, etc

• Wilson Prata: the UI, usability and graphic design guy

• My fellow programmer friends: Ademar Reis, Thiago M. P. Santos and Tomaz Noleto

• Ros Macmahon(j2me), Allison Azevedo (Fedora), Axel Beckert (Debian)

Page 33: Amora: A mobile remote assistant

33 © INdT 2007 | Company Confidential

Why packagers are important?

• “It just works for me with my new, yes, Nokia 6120c smartphone... so easy! Run apt-get install amora-server” (smihael blog)

• “The best remote program i have found is Amora. Works well” (Ubuntu forum)

• “And it must have been written by someone with my exact problem... and am thrilled at how easy it was to set up and how smoothly it works.” (Foosel blog)

• “Oh, and many thanks to foosel since I found Amora in her blog. ” (Axel Beckert, 2 months before making debian package)

Page 34: Amora: A mobile remote assistant

34 © INdT 2007 | Company Confidential

Pycon@BR staff

•O rio de janeiro continua lindo...