btsco - a few comments and a small .py script
Hi,
great work, Andreas! Thanks!
I did a small modification so that you can also finish the call if the call is in progress.
Thanks again,
Whoopie
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
import dbus, sys
class Api_obj:
def __init__(self):
remote_bus = dbus.SystemBus()
system_service_list = remote_bus.get_service('org.freedesktop.DBus').get_object('/org/freedesktop/DBus', 'org.freedesktop.DBus').ListServices() skype_api_found = 0
for service in system_service_list:
if service=='com.Skype.API':
skype_api_found = 1 break
if not skype_api_found:
sys.exit('No running API-capable Skype found')
skype_service = remote_bus.get_service('com.Skype.API') self.skype_api_object = skype_service.get_object('/com/Skype','com.Skype.API')
answer = self.send_message('NAME SkypeApiPythonBluetoothHeadset') if answer != 'OK':
sys.exit('Could not bind to Skype client')
answer = self.send_message('PROTOCOL 1')
# if answer != 'PROTOCOL 1':
# sys.exit('This test program only supports Skype API protocol version 1')
answer = self.send_message('SEARCH ACTIVECALLS')
answer = answer[6:]
status = self.send_message('GET CALL '+answer+' STATUS') status = status[15:]
if status == 'INPROGRESS':
answer = self.send_message('SET CALL '+answer+' STATUS FINISHED')
else:
answer = self.send_message('SET CALL '+answer+' STATUS INPROGRESS')
# Client -> Skype
def send_message(self, message):
answer = self.skype_api_object.Invoke(message) return answer
def main():
api_object = Api_obj()
return 0
if __name__ == "__main__":
main()