.
"kb3013531 näyttäisi poistavan bluetoothin kokonaan joten jätinpä tuon asentamatta :)"
.
kb3013531 poistaa bluetoothin
2
55
Vastaukset
- vaihdalinuxiin
Linuxissa taas voi vaikka itse tehdä oman bluetootsovelluksen, tämä toimii uden bluez5:n kanssa:
#!/usr/bin/python
from __future__ import absolute_import, print_function, unicode_literals
import gobject
import sys
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
BUS_NAME = 'org.bluez.obex'
PATH = '/org/bluez/obex'
AGENT_MANAGER_INTERFACE = 'org.bluez.obex.AgentManager1'
AGENT_INTERFACE = 'org.bluez.obex.Agent1'
BLUEZAGENT_INTERFACE = 'org.bluez.Agent1'
FILETRANSFER_INTERFACE = 'org.bluez.obex.FileTransfer1'
SESSION_INTERFACE='org.bluez.obex.Client1'
TRANSFER_INTERFACE = 'org.bluez.obex.Transfer1'
ADAPTER_INTERFACE = "org.bluez.Adapter1"
DBusGMainLoop(set_as_default=True)
class Adapter():
def get_managed_objects(self):
manager = dbus.Interface(self.bus.get_object("org.bluez", "/"),
"org.freedesktop.DBus.ObjectManager")
return manager.GetManagedObjects()
def find_adapter(self,pattern=None):
return self.find_adapter_in_objects(self.get_managed_objects(), pattern)
def find_adapter_in_objects(self,objects, pattern=None):
for path, ifaces in objects.iteritems():
adapter = ifaces.get(ADAPTER_INTERFACE)
if adapter is None:
continue
if not pattern or pattern == adapter["Address"] or \
path.endswith(pattern):
obj = self.bus.get_object("org.bluez", path)
return dbus.Interface(obj, ADAPTER_INTERFACE)
raise Exception("Bluetooth adapter not found")
def __init__(self):
self.bus = dbus.SystemBus()
adapter_path = self.find_adapter("hci0").object_path
adapter = dbus.Interface(self.bus.get_object("org.bluez", adapter_path),
"org.freedesktop.DBus.Properties")
adapter.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(1))
adapter.Set("org.bluez.Adapter1", "Discoverable", dbus.Boolean(1))
class Agent(dbus.service.Object):
def __init__(self, conn=None, obj_path=None):
dbus.service.Object.__init__(self, conn, obj_path)
@dbus.service.method(AGENT_INTERFACE, in_signature="o",out_signature="s")
def AuthorizePush(self, path):
self.dbus_proxy = dbus.SessionBus().get_object(BUS_NAME, path)
self.transfer = dbus.Interface(self.dbus_proxy,'org.freedesktop.DBus.Properties')
properties = self.transfer.GetAll(TRANSFER_INTERFACE);
print('Downloading to: ~/.cache/obexd/' properties['Name'])
return properties['Name']
@dbus.service.method(AGENT_INTERFACE, in_signature="",out_signature="")
def Cancel(self):
print("Authorization Canceled")
@dbus.service.method(AGENT_INTERFACE, in_signature="", out_signature="")
def Release(self):
return
class Rejected(dbus.DBusException):
_dbus_error_name = "org.bluez.Error.Rejected"
def ask(prompt):
try:
return raw_input(prompt)
except:
return input(prompt)
def set_trusted(path):
props = dbus.Interface(bus.get_object("org.bluez", path),
"org.freedesktop.DBus.Properties")
props.Set("org.bluez.Device1", "Trusted", True)
class BluezAgent(dbus.service.Object):
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="", out_signature="")
def Release(self):
print("Release")
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="os", out_signature="")
def AuthorizeService(self, device, uuid):
print("AuthorizeService (%s, %s)" % (device, uuid))
authorize = ask("Authorize connection (Y/no): ")
if (authorize == "Y" or ""):
return
raise Rejected("Connection rejected by user")
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="o", out_signature="s")
def RequestPinCode(self, device):
print("RequestPinCode (%s)" % (device))
set_trusted(device)
return ask("Enter PIN Code: ")
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="o", out_signature="u")
def RequestPasskey(self, device):
print("RequestPasskey (%s)" % (device))
set_trusted(device)
passkey = ask("Enter passkey: ")
return dbus.UInt32(passkey)
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="ouq", out_signature="")
def DisplayPasskey(self, device, passkey, entered):
print("DisplayPasskey (%s, %06u entered %u)" %
(device, passkey, entered))
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="os", out_signature="")
def DisplayPinCode(self, device, pincode):
print("DisplayPinCode (%s, %s)" % (device, pincode))
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="ou", out_signature="")
def RequestConfirmation(self, device, passkey):- sisennäitse
print("RequestConfirmation (%s, %06d)" % (device, passkey))
confirm = ask("Confirm passkey (Y/no): ")
if (confirm == "Y" or ""):
set_trusted(device)
return
raise Rejected("Passkey doesn't match")
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="o", out_signature="")
def RequestAuthorization(self, device):
print("RequestAuthorization (%s)" % (device))
auth = ask("Authorize? (Y/no): ")
if (auth == "Y" or ""):
return
raise Rejected("Pairing rejected")
@dbus.service.method(BLUEZAGENT_INTERFACE,
in_signature="", out_signature="")
def Cancel(self):
print("Cancel")
class MessageListener():
def __init__(self):
capability = "KeyboardDisplay"
bluezpath = "/test/bluezagent"
bluezagent = BluezAgent(dbus.SystemBus(), bluezpath)
obj = dbus.SystemBus().get_object('org.bluez', "/org/bluez");
bluezmanager = dbus.Interface(obj, "org.bluez.AgentManager1")
bluezmanager.RegisterAgent(bluezagent, capability)
print("Waiting for new devices")
self.manager = dbus.Interface(dbus.SessionBus().get_object(BUS_NAME, PATH), AGENT_MANAGER_INTERFACE)
self.path = "/test/agent"
self.agent = Agent(dbus.SessionBus(), self.path)
try:
manager.UnregisterAgent(self.agent)
except: pass
self.manager.RegisterAgent(self.agent)
print("Waiting for files")
gobject.MainLoop().run()
self.manager.UnregisterAgent(self.agent)
bluezmanager.UnregisterAgent(bluezagent)
if __name__ == '__main__':
Adapter()
MessageListener()
Ketjusta on poistettu 0 sääntöjenvastaista viestiä.
Luetuimmat keskustelut
20e Riskitön veto 20e talletuksella VB:lle
Pssst! Vinkki viis rotvallinreunalla eläjille. VB tarjoaa 20 euron riskittömän vedon ensitallettajille vedonlyöntiin.62463- 1161628
Viiimeinen viesti
Sinulle neiti ristiriita vai mikä nimesi sitten ikinä onkaan. Mulle alkaa riittää tää sekoilu. Oot leikkiny mun tunteill361366Analyysiä: Kiuru-keissi oli ja meni - demarit hävisi tässäkin
Tapauksen tultua julki alkoi demarit ja muu vasemmisto selittään, että tämä oli poliittista väkivaltaa, siis ennen kuin1571205- 521115
- 1161101
Suomessa on valittava 2 lucia neitoa...
Maahanmuuttajille oma lucia neito ja Suomalaisille oma SUOMALAINEN Lucia neito....sama juttu on tehtävä miss Suomi kisoi1051054- 571051
Olet tärkeä
mutta tunnen jotain enemmän ja syvempää. Jos voisinkin kertoa sinulle... Olen lähinnä epätoivoinen ja surullinen.46929- 60892