mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-09 00:09:43 +00:00
log base64 encoded incoming/outgoing packets
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "Runtime/Engine/Classes/Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Runtime/Networking/Public/Networking.h"
|
||||
#include "Runtime/Core/Public/Misc/Base64.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
@@ -60,12 +60,29 @@ void UOscSettings::Send(const uint8 *buffer, int32 length, int32 targetIndex)
|
||||
{
|
||||
SendImpl(&_sendSocket.Get(), buffer, length, *address.second);
|
||||
}
|
||||
UE_LOG(LogOSC, Verbose, TEXT("OSC sent"));
|
||||
|
||||
// Log sent packet
|
||||
if(!LogOSC.IsSuppressed(ELogVerbosity::Verbose))
|
||||
{
|
||||
TArray<uint8> tmp;
|
||||
tmp.Append(buffer, length);
|
||||
const auto encoded = FBase64::Encode(tmp);
|
||||
UE_LOG(LogOSC, Verbose, TEXT("SentAll: %s"), *encoded);
|
||||
}
|
||||
}
|
||||
else if(targetIndex < _sendAddresses.Num())
|
||||
{
|
||||
SendImpl(&_sendSocket.Get(), buffer, length, *_sendAddresses[targetIndex].second);
|
||||
UE_LOG(LogOSC, Verbose, TEXT("OSC sent"));
|
||||
|
||||
// Log sent packet
|
||||
if(!LogOSC.IsSuppressed(ELogVerbosity::Verbose))
|
||||
{
|
||||
TArray<uint8> tmp;
|
||||
tmp.Append(buffer, length);
|
||||
const auto encoded = FBase64::Encode(tmp);
|
||||
const auto target = _sendAddresses[targetIndex].second->ToString(true);
|
||||
UE_LOG(LogOSC, Verbose, TEXT("SentTo %s: %s"), *target, *encoded);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -141,7 +141,6 @@ static void SendBundle(TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct
|
||||
|
||||
void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
||||
{
|
||||
UE_LOG(LogOSC, Verbose, TEXT("OSC Received"));
|
||||
try
|
||||
{
|
||||
const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num());
|
||||
@@ -174,6 +173,13 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
||||
nullptr,
|
||||
ENamedThreads::GameThread);
|
||||
}
|
||||
|
||||
// Log received packet
|
||||
if(!LogOSC.IsSuppressed(ELogVerbosity::Verbose))
|
||||
{
|
||||
const auto encoded = FBase64::Encode(*data);
|
||||
UE_LOG(LogOSC, Verbose, TEXT("Received: %s"), *encoded);
|
||||
}
|
||||
}
|
||||
|
||||
void UOscDispatcher::CallbackMainThread()
|
||||
|
||||
Reference in New Issue
Block a user