mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-28 08:47:19 +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/Engine/Classes/Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "Runtime/Networking/Public/Networking.h"
|
#include "Runtime/Networking/Public/Networking.h"
|
||||||
|
#include "Runtime/Core/Public/Misc/Base64.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|||||||
@@ -60,12 +60,29 @@ void UOscSettings::Send(const uint8 *buffer, int32 length, int32 targetIndex)
|
|||||||
{
|
{
|
||||||
SendImpl(&_sendSocket.Get(), buffer, length, *address.second);
|
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())
|
else if(targetIndex < _sendAddresses.Num())
|
||||||
{
|
{
|
||||||
SendImpl(&_sendSocket.Get(), buffer, length, *_sendAddresses[targetIndex].second);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ static void SendBundle(TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct
|
|||||||
|
|
||||||
void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
||||||
{
|
{
|
||||||
UE_LOG(LogOSC, Verbose, TEXT("OSC Received"));
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num());
|
const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num());
|
||||||
@@ -174,6 +173,13 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
|||||||
nullptr,
|
nullptr,
|
||||||
ENamedThreads::GameThread);
|
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()
|
void UOscDispatcher::CallbackMainThread()
|
||||||
|
|||||||
Reference in New Issue
Block a user