Fixed udsGetChannel() output. Implemented udsSetApplicationData() and udsGetApplicationData(). Added a comment regarding why there's debug prints in udsConnectNetwork().
This commit is contained in:
parent
d2f9655d8a
commit
9ad6e0945c
@ -169,6 +169,21 @@ void udsGenerateDefaultNetworkStruct(udsNetworkStruct *network, u32 wlancommID,
|
|||||||
*/
|
*/
|
||||||
Result udsScanBeacons(u8 *outbuf, u32 maxsize, udsNetworkScanInfo **networks, u32 *total_networks, u32 wlancommID, u8 id8, u8 *host_macaddress);
|
Result udsScanBeacons(u8 *outbuf, u32 maxsize, udsNetworkScanInfo **networks, u32 *total_networks, u32 wlancommID, u8 id8, u8 *host_macaddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This can be used by the host to set the appdata contained in the broadcasted beacons.
|
||||||
|
* @param buf Appdata buffer.
|
||||||
|
* @param size Size of the input appdata.
|
||||||
|
*/
|
||||||
|
Result udsSetApplicationData(u8 *buf, u32 size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This can be used while on a network(host/client) to get the appdata from the current beacon.
|
||||||
|
* @param buf Appdata buffer.
|
||||||
|
* @param size Max size of the output buffer.
|
||||||
|
* @param actual_size If set, the actual size of the appdata written into the buffer is stored here.
|
||||||
|
*/
|
||||||
|
Result udsGetApplicationData(u8 *buf, u32 size, u32 *actual_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a bind.
|
* @brief Create a bind.
|
||||||
* @param bindcontext The output bind context.
|
* @param bindcontext The output bind context.
|
||||||
@ -215,7 +230,7 @@ Result udsSendTo(u16 dst_NetworkNodeID, u8 input8, u8 flags, void* buf, size_t s
|
|||||||
* @brief Gets the wifi channel currently being used.
|
* @brief Gets the wifi channel currently being used.
|
||||||
* @param channel Output channel.
|
* @param channel Output channel.
|
||||||
*/
|
*/
|
||||||
Result udsGetChannel(u32 *channel);
|
Result udsGetChannel(u8 *channel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts hosting a new network.
|
* @brief Starts hosting a new network.
|
||||||
|
@ -262,7 +262,7 @@ Result udsCreateNetwork(udsNetworkStruct *network, void* passphrase, size_t pass
|
|||||||
Result udsConnectNetwork(udsNetworkStruct *network, void* passphrase, size_t passphrase_size, udsBindContext *context, u16 recv_NetworkNodeID, udsConnectionType connection_type)
|
Result udsConnectNetwork(udsNetworkStruct *network, void* passphrase, size_t passphrase_size, udsBindContext *context, u16 recv_NetworkNodeID, udsConnectionType connection_type)
|
||||||
{
|
{
|
||||||
Result ret=0;
|
Result ret=0;
|
||||||
printf("connecting...\n");
|
printf("connecting...\n");//Removing these prints caused connecting to fail.
|
||||||
ret = udsipc_ConnectToNetwork(network, passphrase, passphrase_size, connection_type);
|
ret = udsipc_ConnectToNetwork(network, passphrase, passphrase_size, connection_type);
|
||||||
if(R_FAILED(ret))return ret;
|
if(R_FAILED(ret))return ret;
|
||||||
printf("bind...\n");
|
printf("bind...\n");
|
||||||
@ -614,6 +614,54 @@ static Result udsipc_RecvBeaconBroadcastData(u8 *outbuf, u32 maxsize, nwmScanInp
|
|||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result udsSetApplicationData(u8 *buf, u32 size)
|
||||||
|
{
|
||||||
|
u32* cmdbuf=getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0]=IPC_MakeHeader(0x10,1,2); // 0x100042
|
||||||
|
cmdbuf[1]=size;
|
||||||
|
cmdbuf[2]=IPC_Desc_StaticBuffer(size, 4);
|
||||||
|
cmdbuf[3]=(u32)buf;
|
||||||
|
|
||||||
|
Result ret=0;
|
||||||
|
if(R_FAILED(ret=svcSendSyncRequest(__uds_servhandle)))return ret;
|
||||||
|
|
||||||
|
return cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result udsGetApplicationData(u8 *buf, u32 size, u32 *actual_size)
|
||||||
|
{
|
||||||
|
u32* cmdbuf=getThreadCommandBuffer();
|
||||||
|
u32 saved_threadstorage[2];
|
||||||
|
|
||||||
|
cmdbuf[0]=IPC_MakeHeader(0x11,1,0); // 0x110040
|
||||||
|
cmdbuf[1]=size;
|
||||||
|
|
||||||
|
u32 * staticbufs = getThreadStaticBuffers();
|
||||||
|
saved_threadstorage[0] = staticbufs[0];
|
||||||
|
saved_threadstorage[1] = staticbufs[1];
|
||||||
|
|
||||||
|
staticbufs[0] = IPC_Desc_StaticBuffer(size,0);
|
||||||
|
staticbufs[1] = (u32)buf;
|
||||||
|
|
||||||
|
Result ret=0;
|
||||||
|
ret=svcSendSyncRequest(__uds_servhandle);
|
||||||
|
|
||||||
|
staticbufs[0] = saved_threadstorage[0];
|
||||||
|
staticbufs[1] = saved_threadstorage[1];
|
||||||
|
|
||||||
|
if(R_FAILED(ret))return ret;
|
||||||
|
|
||||||
|
ret = cmdbuf[1];
|
||||||
|
|
||||||
|
if(R_SUCCEEDED(ret))
|
||||||
|
{
|
||||||
|
if(actual_size)*actual_size = cmdbuf[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static Result udsipc_Bind(udsBindContext *bindcontext, u32 input0, u8 input1, u16 NetworkNodeID)//input0 and input1 are unknown.
|
static Result udsipc_Bind(udsBindContext *bindcontext, u32 input0, u8 input1, u16 NetworkNodeID)//input0 and input1 are unknown.
|
||||||
{
|
{
|
||||||
u32* cmdbuf=getThreadCommandBuffer();
|
u32* cmdbuf=getThreadCommandBuffer();
|
||||||
@ -709,7 +757,7 @@ Result udsSendTo(u16 dst_NetworkNodeID, u8 input8, u8 flags, void* buf, size_t s
|
|||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result udsGetChannel(u32 *channel)
|
Result udsGetChannel(u8 *channel)
|
||||||
{
|
{
|
||||||
u32* cmdbuf=getThreadCommandBuffer();
|
u32* cmdbuf=getThreadCommandBuffer();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user