OldSchool Library
AdHoc

Functions and structures for managing PSP AdHoc connections. More...

Data Structures

struct  remotePsp
 Structure for holding information about a remote PSP. More...
 

Macros

#define ADHOC_ERROR_WLAN   -1
 WLAN error.
 
#define ADHOC_ERROR_MAC   -2
 MAC address error.
 
#define ADHOC_ERROR_MODULES   -3
 Module loading error.
 
#define ADHOC_ERROR_NET_INIT   -4
 Network initialization error.
 
#define ADHOC_ERROR_INIT   -5
 AdHoc initialization error.
 
#define ADHOC_ERROR_CTL_INIT   -6
 Control initialization error.
 
#define ADHOC_ERROR_CTL_CONNECT   -7
 Control connection error.
 
#define ADHOC_ERROR_PDP_CREATE   -8
 PDP creation error.
 
#define ADHOC_ERROR_MATCHING_INIT   -9
 Matching initialization error.
 
#define ADHOC_ERROR_MATCHING_CREATE   -10
 Matching creation error.
 
#define ADHOC_ERROR_MATCHING_START   -11
 Matching start error.
 
#define MATCHING_JOINED   0x1
 Another PSP has joined.
 
#define MATCHING_SELECTED   0x2
 Another PSP selected to match.
 
#define MATCHING_REJECTED   0x4
 The request has been rejected.
 
#define MATCHING_CANCELED   0x5
 The request has been cancelled.
 
#define MATCHING_ACCEPTED   0x6
 The request has been accepted.
 
#define MATCHING_ESTABLISHED   0x7
 Connection established between PSPs.
 
#define MATCHING_DISCONNECT   0xa
 A PSP has quit.
 
#define ADHOC_UNINIT   -1
 AdHoc not initialized.
 
#define ADHOC_INIT   0
 AdHoc initialized.
 
#define MAX_REMOTEPSP   100
 Maximum remote PSPs.
 

Enumerations

enum  remotePspState {
  OSL_ADHOC_DISCONNECTED = 0 , OSL_ADHOC_JOINED , OSL_ADHOC_SELECTED , OSL_ADHOC_REJECTED ,
  OSL_ADHOC_CANCELED , OSL_ADHOC_ACCEPTED , OSL_ADHOC_ESTABLISHED
}
 Connection states for remote PSPs. More...
 

Functions

int oslAdhocInit (char *productID)
 Initializes the AdHoc connection.
 
int oslAdhocGetState ()
 Retrieves the current connection state.
 
u8 * oslAdhocGetMacAddress ()
 Retrieves the current MAC address of the PSP.
 
int oslAdhocGetRemotePspCount ()
 Retrieves the number of connected remote PSPs.
 
struct remotePsposlAdhocGetPspByMacAddress (const u8 aMacAddress[6])
 Retrieves the remote PSP information by MAC address.
 
struct remotePsposlAdhocGetPspByIndex (int index)
 Retrieves the remote PSP information by index.
 
int oslAdhocRequestConnection (struct remotePsp *aPsp, int timeOut, int(*requestConnectionCB)(int aPspState))
 Requests a connection to a remote PSP.
 
int oslAdhocSendData (struct remotePsp *pPsp, void *data, int lenData)
 Sends data to a remote PSP.
 
int oslAdhocReceiveData (struct remotePsp *pPsp, void *data, int maxLen)
 Receives data from a remote PSP.
 
struct remotePsposlAdhocGetConnectionRequest ()
 Retrieves a remote PSP that is requesting a connection.
 
void oslAdhocRejectConnection (struct remotePsp *aPsp)
 Rejects a connection request from a remote PSP.
 
void oslAdhocAcceptConnection (struct remotePsp *aPsp)
 Accepts a connection request from a remote PSP.
 
void oslAdhocTerm ()
 Terminates the AdHoc connection.
 

Detailed Description

Functions and structures for managing PSP AdHoc connections.

Macro Definition Documentation

◆ ADHOC_ERROR_WLAN

#define ADHOC_ERROR_WLAN   -1

WLAN error.

Error codes for AdHoc operations.

◆ MATCHING_JOINED

#define MATCHING_JOINED   0x1

Another PSP has joined.

Matching states for AdHoc operations.

◆ ADHOC_UNINIT

#define ADHOC_UNINIT   -1

AdHoc not initialized.

AdHoc initialization states.

◆ MAX_REMOTEPSP

#define MAX_REMOTEPSP   100

Maximum remote PSPs.

Maximum number of remote PSPs supported.

Enumeration Type Documentation

◆ remotePspState

Connection states for remote PSPs.

Enumerator
OSL_ADHOC_DISCONNECTED 

PSP Disconnected.

OSL_ADHOC_JOINED 

PSP Joined.

OSL_ADHOC_SELECTED 

PSP selected.

OSL_ADHOC_REJECTED 

Connection rejected.

OSL_ADHOC_CANCELED 

Connection canceled.

OSL_ADHOC_ACCEPTED 

Connection accepted.

OSL_ADHOC_ESTABLISHED 

Connection established.

Function Documentation

◆ oslAdhocInit()

int oslAdhocInit ( char * productID)

Initializes the AdHoc connection.

Parameters
productIDThe product ID for the AdHoc session.
Returns
0 on success, negative value on error (see error codes).

◆ oslAdhocGetState()

int oslAdhocGetState ( )

Retrieves the current connection state.

Returns
Current connection state (see remotePspState).

◆ oslAdhocGetMacAddress()

u8 * oslAdhocGetMacAddress ( )

Retrieves the current MAC address of the PSP.

Returns
Pointer to the MAC address (array of 6 bytes).

◆ oslAdhocGetRemotePspCount()

int oslAdhocGetRemotePspCount ( )

Retrieves the number of connected remote PSPs.

Returns
Number of connected remote PSPs.

◆ oslAdhocGetPspByMacAddress()

struct remotePsp * oslAdhocGetPspByMacAddress ( const u8 aMacAddress[6])

Retrieves the remote PSP information by MAC address.

Parameters
aMacAddressMAC address to search for.
Returns
Pointer to the remotePsp structure if found, NULL otherwise.

◆ oslAdhocGetPspByIndex()

struct remotePsp * oslAdhocGetPspByIndex ( int index)

Retrieves the remote PSP information by index.

Parameters
indexIndex of the remote PSP.
Returns
Pointer to the remotePsp structure if found, NULL otherwise.

◆ oslAdhocRequestConnection()

int oslAdhocRequestConnection ( struct remotePsp * aPsp,
int timeOut,
int(* requestConnectionCB )(int aPspState) )

Requests a connection to a remote PSP.

Parameters
aPspPointer to the remotePsp structure.
timeOutTimeout for the connection request.
requestConnectionCBCallback function for connection status updates.
Returns
0 on success, negative value on error.

◆ oslAdhocSendData()

int oslAdhocSendData ( struct remotePsp * pPsp,
void * data,
int lenData )

Sends data to a remote PSP.

Parameters
pPspPointer to the remotePsp structure.
dataPointer to the data to send.
lenDataLength of the data to send.
Returns
0 on success, negative value on error.

◆ oslAdhocReceiveData()

int oslAdhocReceiveData ( struct remotePsp * pPsp,
void * data,
int maxLen )

Receives data from a remote PSP.

Parameters
pPspPointer to the remotePsp structure.
dataPointer to the buffer to store received data.
maxLenMaximum length of the buffer.
Returns
Length of the received data, 0 if no data received.

◆ oslAdhocGetConnectionRequest()

struct remotePsp * oslAdhocGetConnectionRequest ( )

Retrieves a remote PSP that is requesting a connection.

Returns
Pointer to the remotePsp structure if found, NULL otherwise.

◆ oslAdhocRejectConnection()

void oslAdhocRejectConnection ( struct remotePsp * aPsp)

Rejects a connection request from a remote PSP.

Parameters
aPspPointer to the remotePsp structure.

◆ oslAdhocAcceptConnection()

void oslAdhocAcceptConnection ( struct remotePsp * aPsp)

Accepts a connection request from a remote PSP.

Parameters
aPspPointer to the remotePsp structure.