Byte-swap psm field to callback on ARM: now both client and host work. Move SDP-related constants out where linux can use too.

This commit is contained in:
ehouse 2007-11-03 22:04:06 +00:00
parent 880254c17f
commit 41936fe18a
3 changed files with 24 additions and 6 deletions

View file

@ -42,6 +42,13 @@ typedef enum {
LAST_____FOO LAST_____FOO
} CommsConnType; } CommsConnType;
/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */
#define XW_BT_UUID \
{ 0x83, 0xe0, 0x87, 0xae, 0x4e, 0x18, 0x46, 0xbe, \
0x83, 0xe0, 0x7b, 0x3d, 0xe6, 0xa1, 0xc3, 0x3b }
#define XW_BT_NAME "Crosswords"
/* on Palm BtLibDeviceAddressType is a 48-bit quantity. Linux's typeis the /* on Palm BtLibDeviceAddressType is a 48-bit quantity. Linux's typeis the
same size. Goal is something all platforms support */ same size. Goal is something all platforms support */
typedef struct XP_BtAddr { XP_U8 bits[6]; } XP_BtAddr; typedef struct XP_BtAddr { XP_U8 bits[6]; } XP_BtAddr;

View file

@ -1211,7 +1211,19 @@ btLibSocketEventType68K_TO_ARM( BtLibSocketEventType* out, const unsigned char*
out->eventData.data.dataLen = read_unaligned16( &in[6] ); out->eventData.data.dataLen = read_unaligned16( &in[6] );
out->eventData.data.data = read_unaligned32( &in[8] ); out->eventData.data.data = read_unaligned32( &in[8] );
break; break;
case btLibSocketEventSdpGetPsmByUuid:
out->eventData.sdpByUuid.param.psm = read_unaligned16( &in[10] );
break;
/* These use status and socket only (if anything) */
case btLibSocketEventConnectRequest:
case btLibSocketEventConnectedOutbound:
case btLibSocketEventSendComplete:
case btLibSocketEventDisconnected:
case btLibL2DiscConnPsmUnsupported:
break;
default: /* shut up, compiler */ default: /* shut up, compiler */
XP_ASSERT(0);
break; break;
} }
} }

View file

@ -125,11 +125,10 @@ static void palm_bt_log( const char* btfunc, const char* func, Err err );
#define CALL_ERR(e,f,...) e = f(__VA_ARGS__) #define CALL_ERR(e,f,...) e = f(__VA_ARGS__)
#endif #endif
/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */
static const BtLibSdpUuidType XWORDS_UUID = { static const BtLibSdpUuidType XWORDS_UUID = {
btLibUuidSize128, btLibUuidSize128,
{ 0x83, 0xe0, 0x87, 0xae, 0x4e, 0x18, 0x46, 0xbe, XW_BT_UUID
0x83, 0xe0, 0x7b, 0x3d, 0xe6, 0xa1, 0xc3, 0x3b } }; };
static PalmBTStuff* pbt_checkInit( PalmAppGlobals* globals, static PalmBTStuff* pbt_checkInit( PalmAppGlobals* globals,
XP_Bool* userCancelled ); XP_Bool* userCancelled );
@ -494,8 +493,8 @@ setupServiceRecord( PalmBTStuff* btStuff )
if ( errNone == err ) { if ( errNone == err ) {
CALL_ERR( err, BtLibSdpServiceRecordSetAttributesForSocket, CALL_ERR( err, BtLibSdpServiceRecordSetAttributesForSocket,
btStuff->btLibRefNum, btStuff->u.master.listenSocket, btStuff->btLibRefNum, btStuff->u.master.listenSocket,
(BtLibSdpUuidType*)&XWORDS_UUID, 1, APPNAME, (BtLibSdpUuidType*)&XWORDS_UUID, 1, XW_BT_NAME,
StrLen(APPNAME), btStuff->u.master.sdpRecordH ); StrLen(XW_BT_NAME), btStuff->u.master.sdpRecordH );
/* 5. BtLibSdpServiceRecordStartAdvertising: make an SDP memory /* 5. BtLibSdpServiceRecordStartAdvertising: make an SDP memory
record representing a local SDP service record visible to record representing a local SDP service record visible to
@ -1020,7 +1019,7 @@ socketCallback( BtLibSocketEventType* sEvent, UInt32 refCon )
btStuff->u.slave.remotePsm = sEvent->eventData.sdpByUuid.param.psm; btStuff->u.slave.remotePsm = sEvent->eventData.sdpByUuid.param.psm;
SET_STATE( btStuff, PBTST_SDP_QUERIED ); SET_STATE( btStuff, PBTST_SDP_QUERIED );
pbt_postpone( btStuff, PBT_ACT_CONNECT_L2C ); pbt_postpone( btStuff, PBT_ACT_CONNECT_L2C );
} else if ( sEvent->status == btLibErrSdpQueryDisconnect ) { } else if ( sEvent->status == btLibErrSdpQueryDisconnect ) {
/* Maybe we can just ignore this... */ /* Maybe we can just ignore this... */
XP_ASSERT( GET_STATE(btStuff) == PBTST_NONE ); XP_ASSERT( GET_STATE(btStuff) == PBTST_NONE );
/* waitACL( btStuff ); */ /* waitACL( btStuff ); */