N900 Mission Control

(Set all SIP accounts to online or offline)
(categorize)
 
(19 intermediate revisions not shown)
Line 1: Line 1:
-
= N900 Mission Control =
+
This page aims to document the Mission Control interface on the [[Nokia N900]], as several things have changed since earlier versions of Maemo and previous instructions for e.g. setting presence no longer work as expected.  
-
 
+
-
This page aims to document the Mission Control interface on the Nokia N900, as several things have changed since earlier versions of Maemo and previous instructions for e.g. setting presence no longer work as expected.  
+
It is actively a work in progress as of late July / early August 2010.
It is actively a work in progress as of late July / early August 2010.
-
== Accessing osso-mission-control ==
+
== Mission Control on the N900 ==
-
=== Install mc-tool ===
+
-
mc-tool is not installed by default on the N900, but it is available as part of the package [http://maemo.org/packages/view/libmissioncontrol-utils/ libmissioncontrol-utils].
+
As discussed on the [[Free_Maemo#mission_control|Free Maemo]] page, the Mission Control included on the N900 is not the open-source version from the Telepathy package, but is provided by the osso-mission-control package under a closed-source Nokia licence.
 +
 
 +
=== mc-tool ===
 +
 
 +
There is a commandline utility for interfacing with Mission Control, in the shape of mc-tool. mc-tool is not installed by default on the N900, but is available as part of the package [http://maemo.org/packages/view/libmissioncontrol-utils/ libmissioncontrol-utils]. The built-in help is very limited, so you may wish to [http://manpages.ubuntu.com/manpages/lucid/man1/mc-tool.1.html read the manual] from the Ubuntu site or consult the example scripts further down this page.
=== dbus ===
=== dbus ===
== Example scripts ==
== Example scripts ==
-
=== Set all SIP accounts to online or offline ===
+
 
 +
=== Set MSN (pecan) to stay offline when disconnected ===
 +
 
 +
Since MSN allows only one client connection at a time, signing into MSN from the N900 disconnects it on my desktop PC, and vice versa.
 +
 
 +
Pidgin on my desktop PC handles this gracefully by disabling the account until I manually connect it. msn-pecan, on the other hand, helpfully auto-reconnects on its own authority and fails to respect my disabling auto-connect via mc-tool; if the requested status remains as "available", it reconnects, and that disconnects Pidgin on my desktop again. Grr.
 +
 
 +
You need an instance of dbus-scripts '''on the session bus''' for this one (see instructions on the [[DbusScripts]] page), then you can do the following:
 +
 
 +
==== /etc/dbus-scripts.d/dbus-scripts-settings ====
 +
 
 +
<source lang="text">
 +
#:MSN (pecan) disconnected (session bus)
 +
/usr/bin/offmsn * * org.freedesktop.DBus ReleaseName org.freedesktop.Telepathy.Connection.pecan.msn_pecan.*
 +
</source>
 +
 
 +
==== /usr/bin/offmsn ====
 +
 
 +
<source lang="bash">
 +
#!/bin/sh
 +
# If we got disconnected from MSN (eg by signing in via Pidgin on desktop PC) then set it offline until further notice
 +
mc-tool list | grep "pecan/msn" | awk {'print "mc-tool request "$1" offline"'} | sh
 +
</source>
 +
 
 +
=== Set all SIP accounts online/offline ===
 +
 
 +
These scripts are intended to be run from [[DbusScripts]] when (for example) WiFi is disconnected, or use any of the various schedulers (e.g. Alarmed) to change your availability according to time of day. Also note that "sofiasip" matches the name of the telepathy plugin that handles SIP accounts and not a specific SIP provider, so the commands in this example will operate on all the SIP accounts in 'mc-tool list'.
==== /usr/bin/siponline ====
==== /usr/bin/siponline ====
Line 21: Line 48:
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" online"'} | sh
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" online"'} | sh
</source>
</source>
 +
==== /usr/bin/sipoffline ====
==== /usr/bin/sipoffline ====
Line 27: Line 55:
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" offline"'} | sh
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" offline"'} | sh
</source>
</source>
 +
 +
=== Manage telepathy IM connections interactively from CLI===
==== /usr/bin/im-connections ====
==== /usr/bin/im-connections ====
-
Simple script that will allow you to individually control each account (you must update the LIST variable with your actual accounts (get the names from "mc-tool list") - and update the menu accordingly.  
+
 
 +
Simple script that will allow you to individually control each account (you must update the LIST variable with your actual accounts (get the names from "mc-tool list") - and update the menu accordingly. Courtesy of [http://themattreid.com http://themattreid.com]
<source lang="bash">
<source lang="bash">
Line 109: Line 140:
     done
     done
fi
fi
 +
</source>
 +
 +
== References and further reading ==
 +
 +
=== Telepathy generic documentation ===
 +
 +
* [http://gnomejournal.org/article/84/telepathy-empathy-and-mission-control-5-in-gnome-228 The GNOME Journal: Telepathy, Empathy and Mission Control 5 in GNOME 2.28]
 +
* [http://people.collabora.co.uk/~danni/telepathy-book/ Telepathy Developers Manual]
 +
 +
=== Nokia specific documentation ===
 +
 +
[[Category:Software]]
 +
[[Category:Fremantle]]
 +
[[Category:Connectivity]]

Latest revision as of 10:36, 13 September 2010

This page aims to document the Mission Control interface on the Nokia N900, as several things have changed since earlier versions of Maemo and previous instructions for e.g. setting presence no longer work as expected.

It is actively a work in progress as of late July / early August 2010.

Contents

[edit] Mission Control on the N900

As discussed on the Free Maemo page, the Mission Control included on the N900 is not the open-source version from the Telepathy package, but is provided by the osso-mission-control package under a closed-source Nokia licence.

[edit] mc-tool

There is a commandline utility for interfacing with Mission Control, in the shape of mc-tool. mc-tool is not installed by default on the N900, but is available as part of the package libmissioncontrol-utils. The built-in help is very limited, so you may wish to read the manual from the Ubuntu site or consult the example scripts further down this page.

[edit] dbus

[edit] Example scripts

[edit] Set MSN (pecan) to stay offline when disconnected

Since MSN allows only one client connection at a time, signing into MSN from the N900 disconnects it on my desktop PC, and vice versa.

Pidgin on my desktop PC handles this gracefully by disabling the account until I manually connect it. msn-pecan, on the other hand, helpfully auto-reconnects on its own authority and fails to respect my disabling auto-connect via mc-tool; if the requested status remains as "available", it reconnects, and that disconnects Pidgin on my desktop again. Grr.

You need an instance of dbus-scripts on the session bus for this one (see instructions on the DbusScripts page), then you can do the following:

[edit] /etc/dbus-scripts.d/dbus-scripts-settings

#:MSN (pecan) disconnected (session bus)
/usr/bin/offmsn * * org.freedesktop.DBus ReleaseName org.freedesktop.Telepathy.Connection.pecan.msn_pecan.*

[edit] /usr/bin/offmsn

#!/bin/sh
# If we got disconnected from MSN (eg by signing in via Pidgin on desktop PC) then set it offline until further notice
mc-tool list | grep "pecan/msn" | awk {'print "mc-tool request "$1" offline"'} | sh

[edit] Set all SIP accounts online/offline

These scripts are intended to be run from DbusScripts when (for example) WiFi is disconnected, or use any of the various schedulers (e.g. Alarmed) to change your availability according to time of day. Also note that "sofiasip" matches the name of the telepathy plugin that handles SIP accounts and not a specific SIP provider, so the commands in this example will operate on all the SIP accounts in 'mc-tool list'.

[edit] /usr/bin/siponline

#!/bin/sh
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" online"'} | sh

[edit] /usr/bin/sipoffline

#!/bin/sh
mc-tool list | grep "sofiasip" | awk {'print "mc-tool request "$1" offline"'} | sh

[edit] Manage telepathy IM connections interactively from CLI

[edit] /usr/bin/im-connections

Simple script that will allow you to individually control each account (you must update the LIST variable with your actual accounts (get the names from "mc-tool list") - and update the menu accordingly. Courtesy of http://themattreid.com

#!/bin/sh
#Change status of IM accounts on N900
LIST="haze/yahoo/your_account
haze/aim/your_account"
 
modify() {
    ACCOUNT=$1
    STATE=$2
    echo -n "setting account to $STATE: "
    /usr/bin/mc-tool request $ACCOUNT $STATE
    if [ $? = 0 ]; then
        echo "[OK]"
    else
        echo "[FAIL]"
        exit 1
    fi
    exit 0
}
 
choose() {
    ACCOUNT=$1
    echo "[1] online
[2] offline"
    echo -n "select state: "
    read STATE
    if [ "$STATE" = "1" ]; then
        modify $ACCOUNT "available"
    elif [ "$STATE" = "2" ]; then
        modify $ACCOUNT "offline"
    else 
        echo "incorrect choice"
        exit 1
    fi
}
 
echo "[1] your_account - yahooIM
[2] your_acount - AIM
[2] ALL ACCOUNTS - show status
[3] ALL ACCOUNTS - online
[4] ALL ACCOUNTS - offline"
 
echo -n "select account: "
read r
 
if [ "$r" = "1" ]; then
    choose "haze/yahoo/your_account"
 
elif [ "$r" = "2" ]; then
    choose "haze/aim/your_account"
 
elif [ "$r" = "2" ]; then
    echo "showing status of all accounts"
    for each in $LIST; do
        /usr/bin/mc-tool show $each
    done
 
elif [ "$r" = "3" ]; then
    for each in $LIST; do
        echo -n "setting '$each' to online: "
        /usr/bin/mc-tool request $each available
        if [ $? = 0 ]; then
            echo "[OK]"
        else
            echo "[FAIL]"
        fi
    done
elif [ "$r" = "4" ]; then
    for each in $LIST; do
        echo -n "setting '$each' to offline: "
        /usr/bin/mc-tool request $each offline
        if [ $? = 0 ]; then
            echo "[OK]"
        else
            echo "[FAIL]"
        fi
    done
fi

[edit] References and further reading

[edit] Telepathy generic documentation

[edit] Nokia specific documentation