*/
Result udsUnbind(udsBindContext *bindcontext);
+/**
+ * @brief Waits for the bind event to occur, or checks if the event was signalled. This event is signalled every time new data is available via udsPullPacket().
+ * @return Always true. However if wait=false, this will return false if the event wasn't signalled.
+ * @param bindcontext The bind context.
+ * @param nextEvent Whether to discard the current event and wait for the next event.
+ * @param wait When true this will not return until the event is signalled. When false this checks if the event was signalled without waiting for it.
+ */
+bool udsWaitDataAvailable(udsBindContext *bindcontext, bool nextEvent, bool wait);
+
/**
* @brief Receives data over the network.
* @param bindcontext Bind context.
return ret;
}
+bool udsWaitDataAvailable(udsBindContext *bindcontext, bool nextEvent, bool wait)
+{
+ bool ret = true;
+ u64 delayvalue = U64_MAX;
+
+ if(!wait)delayvalue = 0;
+
+ if(nextEvent)svcClearEvent(bindcontext->event);
+
+ if(svcWaitSynchronization(bindcontext->event, delayvalue)!=0 && !wait)ret = false;
+
+ if(!nextEvent)svcClearEvent(bindcontext->event);
+
+ return ret;
+}
+
static Result usd_parsebeacon(u8 *buf, u32 size, udsNetworkScanInfo *networkscan)
{
Result ret=0;