手机作为Linux PC的蓝牙GPS

时间:2012-06-07 07:24:22

标签: linux mobile bluetooth gps

我有一部带GPS的手机(SE j10i)。我想在Debian PC上通过手机获取坐标。

$hcitool scan
Scanning ...
        30:17:C8:A1:19:BF   Uralbash

$spdtool browse 30:17:C8:A1:19:BF

Browsing 30:17:C8:A1:19:BF ...
Service Description: Sony Ericsson J10
Service RecHandle: 0x10000
Service Class ID List:
  "PnP Information" (0x1200)

Service Name: OBEX SyncML Client
Service RecHandle: 0x2008002
Service Class ID List:
  UUID 128: 00000002-0000-1000-8000-0002ee000002
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
  "OBEX" (0x0008)

Service Name: Serial Port 1
Service RecHandle: 0x2008003
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2

Service Name: Dial-up Networking
Service RecHandle: 0x2008004
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Service Name: Music Streaming Service
Service Provider: Sony Ericsson
Service RecHandle: 0x8000001
Service Class ID List:
  "Audio Source" (0x110a)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 25
  "AVDTP" (0x0019)
    uint16: 0x100
Profile Descriptor List:
  "Advanced Audio" (0x110d)
    Version: 0x0100

Service Name: Remote Control Target Service
Service Provider: Sony Ericsson
Service RecHandle: 0x10000001
Service Class ID List:
  "AV Remote Target" (0x110c)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x102
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0103

Service Name: Remote Control Service
Service Provider: Sony Ericsson
Service RecHandle: 0x10000002
Service Class ID List:
  "AV Remote" (0x110e)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x102
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0103

Service Name: SEMC Watch Phone
Service RecHandle: 0x40000000
Service Class ID List:
  "" (0x8e771401)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 61681
  "RFCOMM" (0x0003)
    Channel: 2

Service Name: SEMC FRCP
Service RecHandle: 0x40000001
Service Class ID List:
  "" (0x8e771503)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 61691
Profile Descriptor List:
  "" (0x8e771501)
    Version: 0x0100

Service Name: PAN Network Access Point
Service Description: NAP provides access to internet for one connecting PANu
Service RecHandle: 0x1000003
Service Class ID List:
  "Network Access Point" (0x1116)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ8: 0 6 dd
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Network Access Point" (0x1116)
    Version: 0x0100

Service Name: PAN user
Service Description: PANu can connect to a Network Access Point to gain access to internet
Service RecHandle: 0x1000004
Service Class ID List:
  "PAN User" (0x1115)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ8: 0 6 dd
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "PAN User" (0x1115)
    Version: 0x0100

Service Name: SEMC HLA
Service RecHandle: 0x40000002
Service Class ID List:
  "" (0x8e771301)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 61689
  "" (0x8e770300)
Profile Descriptor List:
  "" (0x8e771303)
    Version: 0x0100

Service Name: SEMC OBP
Service RecHandle: 0x40000003
Service Class ID List:
  "" (0x8e771602)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 61685
  "" (0x8e770300)
Profile Descriptor List:
  "" (0x8e771601)
    Version: 0x0100

Service Name: Hands-Free Gateway
Service RecHandle: 0x2008005
Service Class ID List:
  "Handsfree Audio Gateway" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 5
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0105

Service Name: Headset Gateway
Service RecHandle: 0x2008006
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100

Service Name: OBEX Object Push
Service RecHandle: 0x2008007
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 6
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x2008008
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100

Service Name: OBEX IrMC Sync Server
Service RecHandle: 0x2008009
Service Class ID List:
  "IrMC Sync" (0x1104)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 8
  "OBEX" (0x0008)
Profile Descriptor List:
  "IrMC Sync" (0x1104)
    Version: 0x0100

Service Name: Phonebook Access PSE
Service RecHandle: 0x200800a
Service Class ID List:
  "Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 11
  "OBEX" (0x0008)
Profile Descriptor List:
  "Phonebook Access" (0x1130)
    Version: 0x0100

我使用串口通道2.我的设置来自/etc/bluetooth/rfcomm.comm

$cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
    # Automatically bind the device at startup
    bind yes;

    # Bluetooth address of the device
    device 30:17:C8:A1:18:BF;

    # RFCOMM channel for the connection
    channel 2;

    # Description of the connection
        comment "SE Elm (Uralbash)";
}

接下来我尝试连接到串口。

$sudo rfcomm bind rfcomm0
$rfcomm
rfcomm0: 30:17:C8:A1:18:BF channel 2 clean
$sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Host is down
$sudo /etc/init.d/bluetooth restart
[ ok ] Stopping bluetooth: /usr/sbin/bluetoothd.
[ ok ] Starting bluetooth: bluetoothd.
$sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Host is down

$sudo rfcomm release 0

$sudo /etc/init.d/bluetooth restart
[ ok ] Stopping bluetooth: /usr/sbin/bluetoothd.
[ ok ] Starting bluetooth: bluetoothd.

$rfcomm show 0
rfcomm0: 30:17:C8:A1:18:BF channel 2 clean

$rfcomm connect 0
Can't connect RFCOMM socket: Host is down

有什么问题?

0 个答案:

没有答案