Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "serialkey.h"
00015 #include <xsens/xsstring.h>
00016 #include <xsens/xscontrol.h>
00017 #include <stdio.h>
00018 #include <iostream>
00019
00020 extern "C"
00021 int setSerialKey()
00022 {
00023 if (strcmp(SERIAL_KEY, "enter serial key here") == 0)
00024 {
00025 {
00026 char serialKey[256];
00027 FILE* fp;
00028 memset(serialKey, 0, 256);
00029 fp = fopen("serial.key", "r");
00030 if (fp)
00031 {
00032 fread(serialKey, 1, 30, fp);
00033 fclose(fp);
00034
00035 if (XsControl::setSerialKey(serialKey))
00036 return 1;
00037 }
00038 }
00039
00040
00041 std::cout << "Please enter valid serial key" << std::endl;
00042 std::cout << "If you built this example yourself you can enter the key in \"serialkey.h\"" << std::endl;
00043 char serialKey[256];
00044 std::cin.getline(serialKey, 256);
00045 XsString serial(serialKey);
00046
00047 if (XsControl::setSerialKey(serial))
00048 {
00049
00050 FILE* fp = fopen("serial.key", "w");
00051 fwrite(serial.c_str(), sizeof(char), serial.size(), fp);
00052 fclose(fp);
00053 return 1;
00054 }
00055 return 0;
00056 }
00057 return XsControl::setSerialKey(SERIAL_KEY);
00058 }