Advertisement
Guest User

Untitled

a guest
May 28th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
  2.  
  3. #include "TestPLC.h"
  4. //For debug
  5. #include "Engine.h"
  6.  
  7. //Snap7 API
  8. #include "Snap7.h"
  9.  
  10.  
  11. class FUE4Snap7GameModule : public FDefaultGameModuleImpl
  12. {
  13. int Error;
  14. TS7Server *Server;
  15.  
  16. /**
  17. * Called right after the module DLL has been loaded and the module object has been created
  18. */
  19. virtual void StartupModule() override
  20. {
  21. Server = new TS7Server;
  22. Error = Server->StartTo("0.0.0.0");
  23. if (Error == 0)
  24. {
  25. GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, "Server started!!");
  26. UE_LOG(LogTemp, Log, TEXT("RUNNING"));
  27. }
  28. else {
  29. GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Server failed to start!!");
  30. UE_LOG(LogTemp, Log, TEXT("FAILED"));
  31. Server->Stop();
  32. delete Server;
  33. }
  34. }
  35.  
  36. /**
  37. * Called before the module is unloaded, right before the module object is destroyed.
  38. */
  39. virtual void ShutdownModule()
  40. {
  41. Server->Stop();
  42. delete Server;
  43. }
  44. };
  45.  
  46. // Override the default implementation with ours implementation =)
  47. IMPLEMENT_PRIMARY_GAME_MODULE(FUE4Snap7GameModule, TestPLC, "TestPLC");
  48.  
  49. //IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, TestPLC, "TestPLC" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement