JBus
JoyBus communication server
jbus::Endpoint Class Reference

#include <Endpoint.hpp>

Public Member Functions

void stop ()
 Request stop of I/O thread and block until joined. Further use of this Endpoint will return GBA_NOT_READY. The destructor calls this implicitly. More...
 
EJoyReturn GBAGetProcessStatus (u8 &percentOut)
 Get status of last asynchronous operation. More...
 
EJoyReturn GBAGetStatusAsync (u8 *status, FGBACallback &&callback)
 Get JOYSTAT register from GBA asynchronously. More...
 
EJoyReturn GBAGetStatus (u8 *status)
 Get JOYSTAT register from GBA synchronously. More...
 
EJoyReturn GBAResetAsync (u8 *status, FGBACallback &&callback)
 Send RESET command to GBA asynchronously. More...
 
EJoyReturn GBAReset (u8 *status)
 Send RESET command to GBA synchronously. More...
 
EJoyReturn GBAReadAsync (u8 *dst, u8 *status, FGBACallback &&callback)
 Send READ command to GBA asynchronously. More...
 
EJoyReturn GBARead (u8 *dst, u8 *status)
 Send READ command to GBA synchronously. More...
 
EJoyReturn GBAWriteAsync (const u8 *src, u8 *status, FGBACallback &&callback)
 Send WRITE command to GBA asynchronously. More...
 
EJoyReturn GBAWrite (const u8 *src, u8 *status)
 Send WRITE command to GBA synchronously. More...
 
EJoyReturn GBAJoyBootAsync (s32 paletteColor, s32 paletteSpeed, const u8 *programp, s32 length, u8 *status, FGBACallback &&callback)
 Initiate JoyBoot sequence on this endpoint. More...
 
unsigned getChan () const
 Get virtual SI channel assigned to this endpoint. More...
 
void setChan (unsigned chan)
 Set virtual SI channel assigned to this endpoint. More...
 
bool connected () const
 Get connection status of this endpoint. More...
 
 Endpoint (u8 chan, net::Socket &&data, net::Socket &&clock)
 
 ~Endpoint ()
 

Friends

class ThreadLocalEndpoint
 

Detailed Description

Main class for performing JoyBoot and subsequent JoyBus I/O operations. Instances should be obtained though the jbus::Listener::accept method.

Constructor & Destructor Documentation

jbus::Endpoint::Endpoint ( u8  chan,
net::Socket &&  data,
net::Socket &&  clock 
)

Here is the caller graph for this function:

jbus::Endpoint::~Endpoint ( )

Here is the caller graph for this function:

Member Function Documentation

bool jbus::Endpoint::connected ( ) const
inline

Get connection status of this endpoint.

Returns
true if connected

Here is the call graph for this function:

EJoyReturn jbus::Endpoint::GBAGetProcessStatus ( u8 percentOut)

Get status of last asynchronous operation.

Parameters
percentOutReference to output transfer percent of GBAJoyBootAsync.
Returns
GBA_READY when idle, or GBA_BUSY when operation in progress.
EJoyReturn jbus::Endpoint::GBAGetStatus ( u8 status)

Get JOYSTAT register from GBA synchronously.

Parameters
statusDestination pointer for EJStatFlags.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAGetStatusAsync ( u8 status,
FGBACallback &&  callback 
)

Get JOYSTAT register from GBA asynchronously.

Parameters
statusDestination pointer for EJStatFlags.
callbackFunctor to execute when operation completes.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAJoyBootAsync ( s32  paletteColor,
s32  paletteSpeed,
const u8 programp,
s32  length,
u8 status,
FGBACallback &&  callback 
)

Initiate JoyBoot sequence on this endpoint.

Parameters
paletteColorPalette for displaying logo in ROM header [0,6].
paletteSpeedPalette interpolation speed for displaying logo in ROM header [-4,4].
programpPointer to program ROM data.
lengthLength of program ROM data.
statusDestination pointer for EJStatFlags.
callbackFunctor to execute when operation completes.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBARead ( u8 dst,
u8 status 
)

Send READ command to GBA synchronously.

Parameters
dstDestination pointer for 4-byte packet of data.
statusDestination pointer for EJStatFlags.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAReadAsync ( u8 dst,
u8 status,
FGBACallback &&  callback 
)

Send READ command to GBA asynchronously.

Parameters
dstDestination pointer for 4-byte packet of data.
statusDestination pointer for EJStatFlags.
callbackFunctor to execute when operation completes.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAReset ( u8 status)

Send RESET command to GBA synchronously.

Parameters
statusDestination pointer for EJStatFlags.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAResetAsync ( u8 status,
FGBACallback &&  callback 
)

Send RESET command to GBA asynchronously.

Parameters
statusDestination pointer for EJStatFlags.
callbackFunctor to execute when operation completes.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAWrite ( const u8 src,
u8 status 
)

Send WRITE command to GBA synchronously.

Parameters
srcSource pointer for 4-byte packet of data. It is not required to keep resident.
statusDestination pointer for EJStatFlags.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
EJoyReturn jbus::Endpoint::GBAWriteAsync ( const u8 src,
u8 status,
FGBACallback &&  callback 
)

Send WRITE command to GBA asynchronously.

Parameters
srcSource pointer for 4-byte packet of data. It is not required to keep resident.
statusDestination pointer for EJStatFlags.
callbackFunctor to execute when operation completes.
Returns
GBA_READY if submitted, or GBA_NOT_READY if another operation in progress.
unsigned jbus::Endpoint::getChan ( ) const
inline

Get virtual SI channel assigned to this endpoint.

Returns
SI channel [0,3]

Here is the caller graph for this function:

void jbus::Endpoint::setChan ( unsigned  chan)
inline

Set virtual SI channel assigned to this endpoint.

Parameters
chanSI channel [0,3]
void jbus::Endpoint::stop ( )

Request stop of I/O thread and block until joined. Further use of this Endpoint will return GBA_NOT_READY. The destructor calls this implicitly.

Friends And Related Function Documentation

friend class ThreadLocalEndpoint
friend

The documentation for this class was generated from the following file: