maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   [Commercial] Rockwatch - Pebble smart watch support for the N9 (https://talk.maemo.org/showthread.php?t=89890)

Alexxxl 2013-12-22 11:23

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
I realized this command shows the last incoming / outgoing call.
but does not show the fact of the call at the moment

Alexxxl 2013-12-22 16:17

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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


Alexxxl 2013-12-22 21:45

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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 2013-12-22 21:53

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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 ...

Alexxxl 2013-12-23 10:21

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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


Alexxxl 2013-12-23 11:36

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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


ARJWright 2013-12-23 17:45

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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.

Elleo 2013-12-24 04:44

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
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.

Ancelad 2013-12-24 06:58

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
Quote:

Originally Posted by Alexxxl (Post 1399885)
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 :)

Alexxxl 2013-12-24 07:45

Re: [Commercial] Rockwatch - Pebble smart watch support for the N9
 
the script was written before you showed me another solution)))


All times are GMT. The time now is 09:14.

vBulletin® Version 3.8.8