Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
- #include "TestPLC.h"
- //For debug
- #include "Engine.h"
- //Snap7 API
- #include "Snap7.h"
- class FUE4Snap7GameModule : public FDefaultGameModuleImpl
- {
- int Error;
- TS7Server *Server;
- /**
- * Called right after the module DLL has been loaded and the module object has been created
- */
- virtual void StartupModule() override
- {
- Server = new TS7Server;
- Error = Server->StartTo("0.0.0.0");
- if (Error == 0)
- {
- GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, "Server started!!");
- UE_LOG(LogTemp, Log, TEXT("RUNNING"));
- }
- else {
- GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Server failed to start!!");
- UE_LOG(LogTemp, Log, TEXT("FAILED"));
- Server->Stop();
- delete Server;
- }
- }
- /**
- * Called before the module is unloaded, right before the module object is destroyed.
- */
- virtual void ShutdownModule()
- {
- Server->Stop();
- delete Server;
- }
- };
- // Override the default implementation with ours implementation =)
- IMPLEMENT_PRIMARY_GAME_MODULE(FUE4Snap7GameModule, TestPLC, "TestPLC");
- //IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, TestPLC, "TestPLC" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement