author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /gammu/emb/common/device/bluetoth/blue_w32.c | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'gammu/emb/common/device/bluetoth/blue_w32.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/device/bluetoth/blue_w32.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gammu/emb/common/device/bluetoth/blue_w32.c b/gammu/emb/common/device/bluetoth/blue_w32.c index a631c9f..8a367f4 100644 --- a/gammu/emb/common/device/bluetoth/blue_w32.c +++ b/gammu/emb/common/device/bluetoth/blue_w32.c | |||
@@ -75,33 +75,33 @@ GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device) | |||
75 | #ifdef BLUETOOTH_RF_SEARCHING | 75 | #ifdef BLUETOOTH_RF_SEARCHING |
76 | 76 | ||
77 | #pragma comment(lib, "irprops.lib") | 77 | #pragma comment(lib, "irprops.lib") |
78 | #pragma comment(lib, "ws2_32.lib") | 78 | #pragma comment(lib, "ws2_32.lib") |
79 | 79 | ||
80 | static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, char *address, WSAPROTOCOL_INFO *protocolInfo) | 80 | static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, char *address, WSAPROTOCOL_INFO *protocolInfo) |
81 | { | 81 | { |
82 | GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; | 82 | GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; |
83 | WSAQUERYSET querySet; | 83 | WSAQUERYSET querySet; |
84 | DWORD flags; | 84 | DWORD flags; |
85 | GUID protocol; | 85 | GUID protocol; |
86 | int i, result; | 86 | int i, result; |
87 | BYTE buffer[2000]; | 87 | BYTE buffer[2000]; |
88 | char addressAsString[1000]; | 88 | char addressAsString[1000]; |
89 | DWORD bufferLength, addressSize; | 89 | DWORD bufferLength, addressSize; |
90 | WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; | 90 | WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; |
91 | HANDLE handle; | 91 | Qt::HANDLE handle; |
92 | GSM_Error error; | 92 | GSM_Error error; |
93 | 93 | ||
94 | memset(&querySet, 0, sizeof(querySet)); | 94 | memset(&querySet, 0, sizeof(querySet)); |
95 | querySet.dwSize = sizeof(querySet); | 95 | querySet.dwSize = sizeof(querySet); |
96 | protocol = L2CAP_PROTOCOL_UUID; | 96 | protocol = L2CAP_PROTOCOL_UUID; |
97 | querySet.lpServiceClassId = &protocol; | 97 | querySet.lpServiceClassId = &protocol; |
98 | querySet.dwNameSpace = NS_BTH; | 98 | querySet.dwNameSpace = NS_BTH; |
99 | querySet.lpszContext = address; | 99 | querySet.lpszContext = address; |
100 | 100 | ||
101 | flags = LUP_FLUSHCACHE | LUP_RETURN_NAME | | 101 | flags = LUP_FLUSHCACHE | LUP_RETURN_NAME | |
102 | LUP_RETURN_TYPE | LUP_RETURN_ADDR | | 102 | LUP_RETURN_TYPE | LUP_RETURN_ADDR | |
103 | LUP_RETURN_BLOB | LUP_RETURN_COMMENT; | 103 | LUP_RETURN_BLOB | LUP_RETURN_COMMENT; |
104 | 104 | ||
105 | result = WSALookupServiceBegin(&querySet, flags, &handle); | 105 | result = WSALookupServiceBegin(&querySet, flags, &handle); |
106 | if (result != 0) return ERR_UNKNOWN; | 106 | if (result != 0) return ERR_UNKNOWN; |
107 | 107 | ||
@@ -125,33 +125,33 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, char *address, WSAPR | |||
125 | error = bluetooth_connect(s,atoi(addressAsString+i+1),address+1); | 125 | error = bluetooth_connect(s,atoi(addressAsString+i+1),address+1); |
126 | result = WSALookupServiceEnd(handle); | 126 | result = WSALookupServiceEnd(handle); |
127 | return error; | 127 | return error; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } | 130 | } |
131 | result = WSALookupServiceEnd(handle); | 131 | result = WSALookupServiceEnd(handle); |
132 | return ERR_NOTSUPPORTED; | 132 | return ERR_NOTSUPPORTED; |
133 | } | 133 | } |
134 | 134 | ||
135 | GSM_Error bluetooth_findchannel(GSM_StateMachine *s) | 135 | GSM_Error bluetooth_findchannel(GSM_StateMachine *s) |
136 | { | 136 | { |
137 | GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; | 137 | GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; |
138 | WSADATA wsaData; | 138 | WSADATA wsaData; |
139 | int i, protocolInfoSize, result; | 139 | int i, protocolInfoSize, result; |
140 | WSAPROTOCOL_INFO protocolInfo; | 140 | WSAPROTOCOL_INFO protocolInfo; |
141 | HANDLE handle; | 141 | Qt::HANDLE handle; |
142 | DWORD flags; | 142 | DWORD flags; |
143 | WSAQUERYSET querySet; | 143 | WSAQUERYSET querySet; |
144 | BYTE buffer[2000]; | 144 | BYTE buffer[2000]; |
145 | char addressAsString[1000]; | 145 | char addressAsString[1000]; |
146 | DWORD bufferLength, addressSize; | 146 | DWORD bufferLength, addressSize; |
147 | WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; | 147 | WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; |
148 | GSM_Error error; | 148 | GSM_Error error; |
149 | 149 | ||
150 | if (WSAStartup(MAKEWORD(2,2), &wsaData)!=0x00) return ERR_DEVICENODRIVER; | 150 | if (WSAStartup(MAKEWORD(2,2), &wsaData)!=0x00) return ERR_DEVICENODRIVER; |
151 | 151 | ||
152 | d->hPhone = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); | 152 | d->hPhone = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); |
153 | if (d->hPhone == INVALID_SOCKET) { | 153 | if (d->hPhone == INVALID_SOCKET) { |
154 | i = GetLastError(); | 154 | i = GetLastError(); |
155 | GSM_OSErrorInfo(s, "Socket in bluetooth_open"); | 155 | GSM_OSErrorInfo(s, "Socket in bluetooth_open"); |
156 | if (i == 10041) return ERR_DEVICENODRIVER;//unknown socket type | 156 | if (i == 10041) return ERR_DEVICENODRIVER;//unknown socket type |
157 | return ERR_UNKNOWN; | 157 | return ERR_UNKNOWN; |