Exemplo n.º 1
0
 def connect(self, header_list=(headers.Target(b"SYNCML-SYNC"), )):
     return Client.connect(self, header_list)
Exemplo n.º 2
0
 def connect(self):
     uuid = b"\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
     return Client.connect(self, header_list=[headers.Target(uuid)])
#!/usr/bin/env python

import bluetooth, os, struct, sys
from PyOBEX import client, headers, responses

if __name__ == "__main__":

    if len(sys.argv) != 4:

        sys.stderr.write("Usage: %s <device address> <port> <file name>\n" %
                         sys.argv[0])
        sys.exit(1)

    device_address = sys.argv[1]
    port = int(sys.argv[2])
    file_name = sys.argv[3]

    c = client.Client(device_address, port)
    r = c.connect(header_list=(headers.Target(b"OBEXObjectPush"), ))

    if not isinstance(r, responses.ConnectSuccess):
        sys.stderr.write("Failed to connect.\n")
        sys.exit(1)

    c.put(file_name, open(file_name).read())
    c.disconnect()

    sys.exit()
Exemplo n.º 4
0
 else:
     prefix = ""
 
 device_address = sys.argv[1]
 
 d = bluetooth.find_service(address=device_address, uuid="1130")
 if not d:
     sys.stderr.write("No Phonebook service found.\n")
     sys.exit(1)
 
 port = d[0]["port"]
 
 # Use the generic Client class to connect to the phone.
 c = client.Client(device_address, port)
 uuid = b"\x79\x61\x35\xf0\xf0\xc5\x11\xd8\x09\x66\x08\x00\x20\x0c\x9a\x66"
 result = c.connect(header_list=[headers.Target(uuid)])
 
 if not isinstance(result, responses.ConnectSuccess):
     sys.stderr.write("Failed to connect to phone.\n")
     sys.exit(1)
 
 # Access the list of vcards in the phone's internal phone book.
 hdrs, cards = c.get(prefix+"telecom/pb", header_list=[headers.Type(b"x-bt/vcard-listing")])
 
 # Parse the XML response to the previous request.
 root = ElementTree.fromstring(cards)
 
 print("\nAvailable cards in %stelecom/pb\n" % prefix)
 
 # Examine each XML element, storing the file names we find in a list, and
 # printing out the file names and their corresponding contact names.
Exemplo n.º 5
0
        if bluetooth.lookup_name(d) == "SM-N900V":
            address = d

    #services = bluetooth.find_service(address=address)
    services = ""

    print("found services: ")
    for s in services:
        if s['name'] is None:
            continue
        print("name: {0}, port: {1}, profiles: {2}".format(
            s['name'], s['port'], s['profiles']))

    map = bluetooth.find_service(uuid="1134", address=address)[0]
    #print(map)
    port = map['port']
    c = client.Client(address, port)
    h = headers.Target(
        '\xBB\x58\x2B\x40\x42\x0C\x11\xDB\xB0\xDE\x08\x00\x20\x0C\x9A\x66')
    conn = c.connect(header_list=[h])
    print("connected")
    resp = c.setpath(name="telecom")
    resp = c.setpath(name="msg")
    getresp = GetMessageListing(c, '')
    SetNotificationRegistration(c, True)
    r = q.get()
    mer = mytypes.xmlToMapEventReport(r)
    print(mer)
    SetNotificationRegistration(c, False)
    c.disconnect()
    print("disconnected, exiting")
Exemplo n.º 6
0
Arquivo: MAS.py Projeto: eliasj/MAP
 def connect(self):
     response = client.Client.connect(
         self, header_list=[headers.Target(MAS_UUID)])
     if not isinstance(response, responses.ConnectSuccess):
         raise Exception