Active Topics

 


Reply
Thread Tools
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#131
I realized this command shows the last incoming / outgoing call.
but does not show the fact of the call at the moment
 
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#132
some ideas ...

script informs on connecting / disconnecting the charger

notifies the charge reaches 70% 50% 30% 20% 10% 5%

will soon be additional functionality

Code:
#!/bin/bash
status=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key maemo.charger.connection_status)
echo $status > /home/user/MyDocs/status.log
echo "no" > /home/user/MyDocs/level.log
echo "no" > /home/user/MyDocs/level1.log
echo "no" > /home/user/MyDocs/level2.log
echo "no" > /home/user/MyDocs/level3.log
echo "no" > /home/user/MyDocs/level4.log
echo "no" > /home/user/MyDocs/level5.log
#Создаем первоначальный лог

source /tmp/session_bus_address.user
while true
do


# #############################charge on/off###################################

status=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key maemo.charger.connection_status)
log=$(cat /home/user/MyDocs/status.log)
if [[ "$status" == "$log" ]]; then
:
else
if [[ "$status" == "connected" ]]; then
qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge Connected!"
echo $status > /home/user/MyDocs/status.log
else
qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge disconnected!"
echo $status > /home/user/MyDocs/status.log
fi
fi
 
# ########################## charge level 70%##################################

level=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog=$(cat /home/user/MyDocs/level.log) 
	if [[ "$level" == "70" ]]; then
		if [[ "$levellog" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 70%"
			echo "ok" > /home/user/MyDocs/level.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level.log
	fi
 
 
# ########################## charge level 50%##################################

level1=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog1=$(cat /home/user/MyDocs/level1.log) 
	if [[ "$level1" == "50" ]]; then
		if [[ "$levellog1" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 50%"
			echo "ok" > /home/user/MyDocs/level1.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level1.log
	fi
 

# ########################## charge level 30%##################################

# charge level 30%
level2=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog2=$(cat /home/user/MyDocs/level1.log) 
	if [[ "$level2" == "30" ]]; then
		if [[ "$levellog2" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 30%"
			echo "ok" > /home/user/MyDocs/level2.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level2.log
	fi
 



# ########################## charge level 20%##################################

level3=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog3=$(cat /home/user/MyDocs/level1.log) 
	if [[ "$level3" == "20" ]]; then
		if [[ "$levellog2" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 20%"
			echo "ok" > /home/user/MyDocs/level3.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level3.log
	fi


# ########################## charge level 10%##################################

level4=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog4=$(cat /home/user/MyDocs/level1.log) 
	if [[ "$level4" == "10" ]]; then
		if [[ "$levellog2" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 10%"
			echo "ok" > /home/user/MyDocs/level4.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level4.log
	fi

# ########################## charge level 5%##################################

level5=$(hal-get-property --udi /org/freedesktop/Hal/devices/bme --key battery.charge_level.percentage)
levellog5=$(cat /home/user/MyDocs/level1.log) 
	if [[ "$level5" == "5" ]]; then
		if [[ "$levellog2" == "ok" ]]; then
		:
			else
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "Charge level 5% LOW POWER!!!"
			echo "ok" > /home/user/MyDocs/level5.log
     		fi
     else
     echo "no" > /home/user/MyDocs/level5.log
	fi




sleep 1
done

Last edited by Alexxxl; 2013-12-24 at 10:42.
 
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#133
another script monitors the status of your internet connection, and informs when connecting ... GPRS / wlan, connected / disconnected:

Code:
#!/bin/bash


echo "-" > /home/user/MyDocs/wifi_log.log


source /tmp/session_bus_address.user
while true
do


name_wifi=$(qdbus --system com.nokia.icd2.context /org/maemo/contextkit/Internet/NetworkName org.maemo.contextkit.Property.Get | sed q)
status_wifi=$(qdbus --system com.nokia.icd2.context /org/maemo/contextkit/Internet/NetworkState org.maemo.contextkit.Property.Get | sed q)
wifi_log=$(cat /home/user/MyDocs/wifi_log.log)
lan=$(qdbus --system com.nokia.icd2.context /org/maemo/contextkit/Internet/NetworkType org.maemo.contextkit.Property.Get | sed q)

if [[ "$status_wifi" == "connected" ]]; then
          if [[ "$status_wifi" == "$wifi_log" ]]; then
          :
          else     
          qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "$lan ""$name_wifi ""$status_wifi"
          echo $status_wifi > /home/user/MyDocs/wifi_log.log
	   echo $name_wifi > /home/user/MyDocs/wifi_log1.log
	   echo $lan > /home/user/MyDocs/wifi_lan.log
          fi
else
if [[ "$status_wifi" == "disconnected" ]]; then
          if [[ "$status_wifi" == "$wifi_log" ]]; then
          :
          else     
          wf_name=$(cat /home/user/MyDocs/wifi_log1.log)
          lan_name=$(cat /home/user/MyDocs/wifi_lan.log)
	   qdbus com.mikeasoft.rockwatch /rockwatch showSMS "N9" "$lan_name ""$wf_name ""$status_wifi"
          echo $status_wifi > /home/user/MyDocs/wifi_log.log
fi
fi
fi

sleep 1
done
 
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#134
in the near future:

information about connecting to whatsup / wazzap

weather from meecast (information every two hours)

state RAM (how often have not decided yet)



anything else ...
 

The Following User Says Thank You to Alexxxl For This Useful Post:
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#135
Meecast

Code:
#!/bin/bash

source /tmp/session_bus_address.user
while true
do


echo "$(qdbus com.meecast.data /com/meecast/data com.meecast.data.GetCurrentWeather)" > /usr/share/meecast.txt
a=$(sed '1!d' /usr/share/meecast.txt)

b=$(sed '2!d' /usr/share/meecast.txt)
c=$(sed '6!d' /usr/share/meecast.txt)
d=$(sed '8!d' /usr/share/meecast.txt)

# echo $a $b $c $d

qdbus com.mikeasoft.rockwatch /rockwatch showSMS "Meecast" "$a ,       ""$b В°C, ""$c,        ""$d"


sleep 7200 
# 2 hours
done

Last edited by Alexxxl; 2013-12-23 at 10:24.
 
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#136
Until he realized functional display the name calling, you can use a script like this (draft, but working)

Code:
#!/bin/bash
echo "-" > /home/user/MyDocs/id_log.log
source /tmp/session_bus_address.user
while true
do
call=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/CallStatusBar org.maemo.contextkit.Property.Get | sed '1!d')
id=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/ActiveCall org.maemo.contextkit.Property.Get | sed '6!d')
id_log=$(cat /home/user/MyDocs/id_log.log)
      if [[ "$id" == "$id_log" ]]; then
	:           
         else    
	#if [[ "$call" == "true" ]]; then 
	  if [[ "$id" != "$id_log" ]]; then
	name=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/ActiveCall org.maemo.contextkit.Property.Get | grep displayName | cut -d ' ' -f2)
 	qdbus com.mikeasoft.rockwatch /rockwatch showSMS "INCOMING CALL " "$name"         
sleep 1	
	qdbus com.mikeasoft.rockwatch /rockwatch showSMS "INCOMING CALL " "$name"    
sleep 2
	qdbus com.mikeasoft.rockwatch /rockwatch showSMS "$name" "INCOMING CALL "          
sleep 0.3
	qdbus com.mikeasoft.rockwatch /rockwatch showSMS "$name" "INCOMING CALL "     
	echo $id > /home/user/MyDocs/id_log.log
fi
fi
 sleep 1
done

upd:
slightly improved.

notification is triggered only if the smartphone is locked

Code:
#!/bin/sh
echo "-" > /home/user/MyDocs/id_log.log
source /tmp/session_bus_address.user
while true
do
call=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/CallStatusBar org.maemo.contextkit.Property.Get | sed '1!d')
id=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/ActiveCall org.maemo.contextkit.Property.Get | sed '6!d')
id_log=$(cat /home/user/MyDocs/id_log.log)
      if [[ "$id" == "$id_log" ]]; then
	:           
      else    
if [[ "$call" == "true" ]]; then 
		if [[ "$id" != "$id_log" ]]; then
			name=$(qdbus com.nokia.CallUi.Context /com/nokia/CallUi/ActiveCall org.maemo.contextkit.Property.Get | grep displayName | cut -d ' ' -f2)
 			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "INCOMING CALL " "$name"         
			sleep 1	
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "INCOMING CALL " "$name"    
			sleep 2
			qdbus com.mikeasoft.rockwatch /rockwatch showSMS "$name" "INCOMING CALL "          
     			echo $id > /home/user/MyDocs/id_log.log
		else
			: 
		fi
else
			: 
		fi



	fi
 sleep 1
done

Last edited by Alexxxl; 2013-12-23 at 13:50.
 
ARJWright's Avatar
Posts: 861 | Thanked: 734 times | Joined on Jan 2008 @ Nomadic
#137
dang... latest developments are kinda hot. I'm using a Polar Loop right now, but this might make me pick up a Pebble a good bit faster than I figured I'd get a new one.

Seriously, this is nice work.
 

The Following User Says Thank You to ARJWright For This Useful Post:
Elleo's Avatar
Posts: 266 | Thanked: 979 times | Joined on Jan 2010 @ London
#138
Just uploaded version 1.3 for QA, hopefully it'll get processed before the store gets locked down. This version now adds caller id for incoming call notifications and fixes incorrect time offsets when setting the watch's time from the phone.

Any future releases will be through OpenRepos and will probably just be donation supported.
 

The Following 5 Users Say Thank You to Elleo For This Useful Post:
Ancelad's Avatar
Posts: 1,552 | Thanked: 3,108 times | Joined on Jun 2012 @ Russia, 96
#139
Originally Posted by Alexxxl View Post
Meecast

Code:
#!/bin/bash

source /tmp/session_bus_address.user
while true
do


echo "$(qdbus com.meecast.data /com/meecast/data com.meecast.data.GetCurrentWeather)" > /usr/share/meecast.txt
a=$(sed '1!d' /usr/share/meecast.txt)

b=$(sed '2!d' /usr/share/meecast.txt)
c=$(sed '6!d' /usr/share/meecast.txt)
d=$(sed '8!d' /usr/share/meecast.txt)

# echo $a $b $c $d

qdbus com.mikeasoft.rockwatch /rockwatch showSMS "Meecast" "$a ,       ""$b В°C, ""$c,        ""$d"


sleep 7200 
# 2 hours
done
Hmm, why you use old version? I've told you new one yesterday, as you remember
 

The Following User Says Thank You to Ancelad For This Useful Post:
Alexxxl's Avatar
Posts: 152 | Thanked: 91 times | Joined on Mar 2013 @ Russia Saratov
#140
the script was written before you showed me another solution)))
 
Reply

Tags
nokia n9, smart watch


 
Forum Jump


All times are GMT. The time now is 17:29.