Advertisement
Zac_McDonald

CgSDK Testing Program

Sep 29th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "CgSDK.x64_2015.h"
  3. #include <iostream>
  4. #include <cstdint>
  5.  
  6. const char* toString(CorsairError error)
  7. {
  8.     switch (error){
  9.     case CE_Success:
  10.         return "CE_Success";
  11.     case CE_ServerNotFound:
  12.         return "CE_ServerNotFound";
  13.     case CE_NoControl:
  14.         return "CE_NoControl";
  15.     case CE_ProtocolHandshakeMissing:
  16.         return "CE_ProtocolHandshakeMissing";
  17.     case CE_IncompatibleProtocol:
  18.         return "CE_IncompatibleProtocol";
  19.     case CE_InvalidArguments:
  20.         return "CE_InvalidArguments";
  21.     default:
  22.         return "unknown error";
  23.     }
  24. }
  25.  
  26. int main()
  27. {  
  28.     CorsairProtocolDetails details = CgSdkPerformProtocolHandshake();
  29.     std::cout << "SDK Version: " << details.sdkVersion << std::endl;
  30.     std::cout << "SDK Protocol Version: " << details.sdkProtocolVersion << std::endl;
  31.     std::cout << "Server Version: " << details.serverVersion << std::endl;
  32.     std::cout << "Server Protocol Version: " << details.serverProtocolVersion << std::endl << std::endl;
  33.  
  34.     if (const auto error = CgSdkGetLastError())
  35.     {
  36.         std::cout << "Handshake failed: " << toString(error) << "\nPress any key tro quit." << std::endl;
  37.         std::cin.get();
  38.         return -1;
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement