#!/bin/bash

go_online=$1

if [ -z "$mode" ]; then
	if dbus-send --print-reply --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.get_device_mode | grep -q normal; then
		go_online=0
	else
		go_online=1
	fi
fi

if [ "$go_online" = 0 ]; then
	mode=offline
else
	mode=normal
fi

dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"$mode"
