Difference between revisions of "Mac OS X Porting - Apple Remote implementation"
(→'''Intercept events with the remote, and trace''') |
(→'''Intercept events with the remote, and trace''') |
||
Line 65: | Line 65: | ||
* '''+''' as value "2" | * '''+''' as value "2" | ||
* '''|> ||''' (play pause) as value "16" | * '''|> ||''' (play pause) as value "16" | ||
+ | * long hold with key '''Menu'' (kRemoteButtonMenu_Hold) is seen as value "512" | ||
+ | * long hold with key '''Play ''' (kRemoteButtonPlay_Hold) is seen as value "1024" | ||
+ | * long hold with key '''Backward''' (kRemoteButtonLeft_Hold) is seen as value "2048" | ||
+ | * long hold with key '''Forward''' (kRemoteButtonRight_Hold) is seen as value "4096" | ||
Important: when in Front Row mode, the events are seen too, and accordingly to the link below, there is a way to programaticaly enable / disable it. | Important: when in Front Row mode, the events are seen too, and accordingly to the link below, there is a way to programaticaly enable / disable it. |
Revision as of 20:16, 14 July 2008
Contents
Apple Remote Implementation
Initial Code is from Martin Kahr. See Martin website
Note: the existing code allows to use the Keyspan remote device. If you have such device, please provide us feedback and help us to make it work
Modes
The current idea is to implement the modes described below. If you have a better idea (not too complicated though), please tell us.
1) Mode not presenting (Standard Mode?)
- Hit |> || symbol (play /pause) starts the presentation
- Other buttons are inactive in not presenting mode
2) Mode Presentation (Presentation Mode?)
- Hit Page backward ( |<< symbol ) gives Previous page (if exists)
- Hit Page forward ( >>| symbol) gives Next page (if exists)
- Menu key toggles navigator Open/Closed
- Play/Pause (|> || symbol) play/pause media or automation
- When not in navigator mode, hold Menu ends the presentation
Make it buildable
Done. With the current code, no warnings, everything is delivered as expected.
Integrate the code in OpenOffice.org for Mac OS X
Done :
Concerned modules :
- external (Apple Remote code will be there due to the MIT License )
- scp2 : libAppleRemotemxi.dylib has to be packaged
- vcl : MainControler object and notifications are detected by the NSApplication in all its life
Code :
- created external/AppleRemote tree
- created the makefile, links against IOKit framework
- modified prj/build.lst to build external/AppleRemote
- modified prj/d.lst to deliver the headers in the solver (vcl will need them) and deliver libAppleRemotemxi.dylib
- build is ok : no warning (fixed the static issue, and all the other warnings , made the code more robust)
- in vcl : modified the makefile ( linking against libAppleRemotemxi.dylib ), added mpMainController member in SalData ( saldata.hxx ),
initialized mpMainController in the SalData Ctor, added the MainController initialization in initNSApp() (salinst.cxx)
- Packaging works as expected, and OpenOffice.org works fine with the new lib included in the archive
Work in progress
we need to initialize a RemoteControl * object, and a RemoteControlBehavior * object too, then we'll be able to see a trace when hitting a button
Intercept events with the remote, and trace
Adding some NSLog at the right place, we have the numerical values returned by the remote:
- Menu button is seen as the value "8"
- <<| is seen as "64"
- >>| is seen as value "32"
- - is seen as value "4"
- + as value "2"
- |> || (play pause) as value "16"
- long hold with key 'Menu (kRemoteButtonMenu_Hold) is seen as value "512"
- long hold with key Play (kRemoteButtonPlay_Hold) is seen as value "1024"
- long hold with key Backward (kRemoteButtonLeft_Hold) is seen as value "2048"
- long hold with key Forward (kRemoteButtonRight_Hold) is seen as value "4096"
Important: when in Front Row mode, the events are seen too, and accordingly to the link below, there is a way to programaticaly enable / disable it.
TODO :
- bind with vcl events
- make it work
- improve
- make it work also with OOo Presenter extension
XSlideShowController use
Philipp Lohmann presented me Andre Fisher, the specialist of the thing. Andre kindly explained me where start :
From Andre mail :
First you need access to the XSlideShowController. You get that from a model (document) like this Reference<XModel> xModel; // Given. Reference<XPresentationSupplier> xPS ( xModel, UNO_QUERY_THROW); Reference<XPresentation2> xP ( xPS->getPresentation(), UNO_QUERY_THROW); Reference<XSlideShowController> xSSC ( xP->getController()); The XSlideShowController provides the functionality to change slides and get information about the current slide. You can find the interfaces in com/sun/star/presentation.
bind with vcl events
=> TODO
Make it work
=> TODO
Create the cws and commit
TODO: file the issue, and ask mh the alias to be created. (maybe things are more easy now ?)
Improve
- Did Apple document the API since ?
- Document how things are working '[started]
- Does an Impress Controller API exist ?
- Contact Andre Fisher, the specialist of the thing (said Philipp Lohmann) [done]
- Find where the events are managed in slideshow (or sd) ? [ask Thorsten]
Code description
Files :
TODO
Using different devices
Right now the wrapper ships with support for three devices:
- AppleRemote: Apple Remote Control
- KeyspanFrontRowControl: Keyspan RF Remote for FrontRow
- GlobalKeyboardDevice: Registers global keyboard shortcuts to provide a virtual remote control