Update C#, Java wrapper, documents
@@ -8,6 +8,61 @@ namespace Emotiv
|
|||||||
{
|
{
|
||||||
public class EmotivCloudClient
|
public class EmotivCloudClient
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//! Default success value.
|
||||||
|
public const Int32 EC_OK = 0x0000;
|
||||||
|
|
||||||
|
//! An internal error occurred.
|
||||||
|
public const Int32 EC_UNKNOWN_ERROR = 0x0001;
|
||||||
|
|
||||||
|
//! An internal error occurred.
|
||||||
|
public const Int32 EC_COULDNT_RESOLVE_PROXY = 0x0002;
|
||||||
|
|
||||||
|
public const Int32 EC_COULDNT_RESOLVE_HOST = 0x0003;
|
||||||
|
|
||||||
|
public const Int32 EC_COULDNT_CONNECT = 0x0004;
|
||||||
|
|
||||||
|
//! Profile created by EC_SaveUserProfile() is existed in Emotiv Cloud.
|
||||||
|
public const Int32 EC_PROFILE_CLOUD_EXISTED = 0x0101;
|
||||||
|
|
||||||
|
//! The buffer is not a valid, serialized EmoEngine profile.
|
||||||
|
public const Int32 EC_INVALID_PROFILE_ARCHIVE = 0x0102;
|
||||||
|
|
||||||
|
//! One of the parameters supplied to the function is invalid
|
||||||
|
public const Int32 EC_INVALID_PARAMETER = 0x0300;
|
||||||
|
|
||||||
|
//! A parameter supplied to the function is out of range.
|
||||||
|
public const Int32 EC_OUT_OF_RANGE = 0x0301;
|
||||||
|
|
||||||
|
//! A filesystem error occurred.
|
||||||
|
public const Int32 EC_FILESYSTEM_ERROR = 0x0302;
|
||||||
|
|
||||||
|
//! The buffer supplied to the function is not large enough.
|
||||||
|
public const Int32 EC_BUFFER_TOO_SMALL = 0x0303;
|
||||||
|
|
||||||
|
//! The file uploaded to cloud is failed
|
||||||
|
public const Int32 EC_UPLOAD_FAILED = 0x0304;
|
||||||
|
|
||||||
|
//! The cloud user ID supplied to the function is invalid.
|
||||||
|
public const Int32 EC_INVALID_CLOUD_USER_ID = 0x0400;
|
||||||
|
|
||||||
|
//! The user ID supplied to the function is invalid
|
||||||
|
public const Int32 EC_INVALID_ENGINE_USER_ID = 0x0401;
|
||||||
|
|
||||||
|
//! The user ID supplied to the function dont login, call EC_Login() first
|
||||||
|
public const Int32 EC_CLOUD_USER_ID_DONT_LOGIN = 0x0402;
|
||||||
|
|
||||||
|
//! The Emotiv Cloud needs to be initialized via EC_Connect()
|
||||||
|
public const Int32 EC_EMOTIVCLOUD_UNINITIALIZED = 0x0500;
|
||||||
|
|
||||||
|
//! The Emotiv Engine needs to be initialized via IEE_EngineConnect() or IEE_EngineRemoteConnect() before call EC_Connect() or Emotiv Engine is disconnected
|
||||||
|
public const Int32 EC_EMOENGINE_UNINITIALIZED = 0x0501;
|
||||||
|
|
||||||
|
public const Int32 EC_FILE_EXISTS = 0x1001;
|
||||||
|
|
||||||
|
//! Reserved return value.
|
||||||
|
public const Int32 EC_RESERVED1 = 0x0900;
|
||||||
|
|
||||||
public enum profileFileType
|
public enum profileFileType
|
||||||
{
|
{
|
||||||
TRAINING,
|
TRAINING,
|
||||||
@@ -21,43 +76,43 @@ namespace Emotiv
|
|||||||
};
|
};
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Connect")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Connect")]
|
||||||
public static extern bool EC_Connect();
|
public static extern Int32 EC_Connect();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ReconnectEngine")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ReconnectEngine")]
|
||||||
public static extern bool EC_ReconnectEngine();
|
public static extern Int32 EC_ReconnectEngine();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DisconnectEngine")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DisconnectEngine")]
|
||||||
public static extern bool EC_DisconnectEngine();
|
public static extern Int32 EC_DisconnectEngine();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Disconnect")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Disconnect")]
|
||||||
public static extern void EC_Disconnect();
|
public static extern Int32 EC_Disconnect();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Login")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Login")]
|
||||||
public static extern bool EC_Login(String email, String password);
|
public static extern Int32 EC_Login(String email, String password);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Logout")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Logout")]
|
||||||
public static extern bool EC_Logout(int userCloudID);
|
public static extern Int32 EC_Logout(int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetUserDetail")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetUserDetail")]
|
||||||
public static extern bool EC_GetUserDetail(ref int userCloudID);
|
public static extern Int32 EC_GetUserDetail(ref int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_SaveUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_SaveUserProfile")]
|
||||||
public static extern bool EC_SaveUserProfile(int userCloudID, int engineUserID, String profileName, profileFileType ptype);
|
public static extern Int32 EC_SaveUserProfile(int userCloudID, int engineUserID, String profileName, profileFileType ptype);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_UpdateUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_UpdateUserProfile")]
|
||||||
public static extern bool EC_UpdateUserProfile(int userCloudID, int engineUserID, int profileId);
|
public static extern Int32 EC_UpdateUserProfile(int userCloudID, int engineUserID, int profileId);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DeleteUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DeleteUserProfile")]
|
||||||
public static extern bool EC_DeleteUserProfile(int userCloudID, int profileId);
|
public static extern Int32 EC_DeleteUserProfile(int userCloudID, int profileId);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetProfileId")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetProfileId")]
|
||||||
public static extern int EC_GetProfileId(int userCloudID, String profileName);
|
public static extern int EC_GetProfileId(int userCloudID, String profileName);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_LoadUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_LoadUserProfile")]
|
||||||
public static extern bool EC_LoadUserProfile(int userCloudID, int engineUserID, int profileId, int version);
|
public static extern Int32 EC_LoadUserProfile(int userCloudID, int engineUserID, int profileId, int version);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetAllProfileName")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetAllProfileName")]
|
||||||
public static extern int EC_GetAllProfileName(int userCloudID);
|
public static extern Int32 EC_GetAllProfileName(int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ProfileIDAtIndex")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ProfileIDAtIndex")]
|
||||||
public static extern int EC_ProfileIDAtIndex(int userCloudID, int index);
|
public static extern int EC_ProfileIDAtIndex(int userCloudID, int index);
|
||||||
|
|||||||
@@ -43,12 +43,14 @@ namespace SavingAndLoadingProfileCloud
|
|||||||
|
|
||||||
if (profileID >= 0) {
|
if (profileID >= 0) {
|
||||||
Console.WriteLine("Profile with " + profileName + " is existed");
|
Console.WriteLine("Profile with " + profileName + " is existed");
|
||||||
if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, engineUserID, profileID)) {
|
if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, engineUserID, profileID) != EmotivCloudClient.EC_OK )
|
||||||
|
{
|
||||||
Console.WriteLine("Updating finished");
|
Console.WriteLine("Updating finished");
|
||||||
}
|
}
|
||||||
else Console.WriteLine("Updating failed");
|
else Console.WriteLine("Updating failed");
|
||||||
}
|
}
|
||||||
else if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName, EmotivCloudClient.profileFileType.TRAINING))
|
else if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName,
|
||||||
|
EmotivCloudClient.profileFileType.TRAINING) != EmotivCloudClient.EC_OK)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Saving finished");
|
Console.WriteLine("Saving finished");
|
||||||
}
|
}
|
||||||
@@ -60,7 +62,8 @@ namespace SavingAndLoadingProfileCloud
|
|||||||
if (mode == 1)
|
if (mode == 1)
|
||||||
{
|
{
|
||||||
if (getNumberProfile > 0){
|
if (getNumberProfile > 0){
|
||||||
if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, engineUserID, EmotivCloudClient.EC_GetProfileId(userCloudID, profileName), version))
|
if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, engineUserID,
|
||||||
|
EmotivCloudClient.EC_GetProfileId(userCloudID, profileName), version) != EmotivCloudClient.EC_OK)
|
||||||
Console.WriteLine("Loading finished");
|
Console.WriteLine("Loading finished");
|
||||||
else
|
else
|
||||||
Console.WriteLine("Loading failed");
|
Console.WriteLine("Loading failed");
|
||||||
@@ -89,14 +92,14 @@ namespace SavingAndLoadingProfileCloud
|
|||||||
|
|
||||||
ConsoleKeyInfo cki = new ConsoleKeyInfo();
|
ConsoleKeyInfo cki = new ConsoleKeyInfo();
|
||||||
|
|
||||||
if(!EmotivCloudClient.EC_Connect())
|
if (EmotivCloudClient.EC_Connect() != EmotivCloudClient.EC_OK)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Cannot connect to Emotiv Cloud.");
|
Console.WriteLine("Cannot connect to Emotiv Cloud.");
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!EmotivCloudClient.EC_Login(userName, password))
|
if (EmotivCloudClient.EC_Login(userName, password) != EmotivCloudClient.EC_OK)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Your login attempt has failed. The username or password may be incorrect");
|
Console.WriteLine("Your login attempt has failed. The username or password may be incorrect");
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
@@ -105,7 +108,7 @@ namespace SavingAndLoadingProfileCloud
|
|||||||
|
|
||||||
Console.WriteLine("Logged in as " + userName);
|
Console.WriteLine("Logged in as " + userName);
|
||||||
|
|
||||||
if (!EmotivCloudClient.EC_GetUserDetail(ref userCloudID))
|
if (EmotivCloudClient.EC_GetUserDetail(ref userCloudID) != EmotivCloudClient.EC_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ int _kbhit(void);
|
|||||||
#include "Iedk.h"
|
#include "Iedk.h"
|
||||||
#include "IedkErrorCode.h"
|
#include "IedkErrorCode.h"
|
||||||
#include "EmotivCloudClient.h"
|
#include "EmotivCloudClient.h"
|
||||||
|
#include "EmotivCloudErrorCode.h"
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -70,13 +71,13 @@ int main() {
|
|||||||
std::getline(std::cin, input, '\n');
|
std::getline(std::cin, input, '\n');
|
||||||
option = atoi(input.c_str());
|
option = atoi(input.c_str());
|
||||||
|
|
||||||
if(!EC_Connect())
|
if(EC_Connect() != EC_OK)
|
||||||
{
|
{
|
||||||
std::cout << "Cannot connect to Emotiv Cloud";
|
std::cout << "Cannot connect to Emotiv Cloud";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!EC_Login(userName.c_str(), password.c_str()))
|
if(EC_Login(userName.c_str(), password.c_str()) != EC_OK)
|
||||||
{
|
{
|
||||||
std::cout << "Your login attempt has failed. The username or password may be incorrect";
|
std::cout << "Your login attempt has failed. The username or password may be incorrect";
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -87,7 +88,7 @@ int main() {
|
|||||||
|
|
||||||
std::cout<<"Logged in as " << userName << std::endl;
|
std::cout<<"Logged in as " << userName << std::endl;
|
||||||
|
|
||||||
if (!EC_GetUserDetail(&userCloudID))
|
if (EC_GetUserDetail(&userCloudID) != EC_OK)
|
||||||
return -4;
|
return -4;
|
||||||
|
|
||||||
while (!_kbhit())
|
while (!_kbhit())
|
||||||
@@ -115,12 +116,12 @@ int main() {
|
|||||||
|
|
||||||
if (profileID >= 0) {
|
if (profileID >= 0) {
|
||||||
std::cout << "Profile with " << profileName << " is existed" << std::endl;
|
std::cout << "Profile with " << profileName << " is existed" << std::endl;
|
||||||
if (EC_UpdateUserProfile(userCloudID, engineUserID, profileID)) {
|
if (EC_UpdateUserProfile(userCloudID, engineUserID, profileID) == EC_OK) {
|
||||||
std::cout << "Updating finished";
|
std::cout << "Updating finished";
|
||||||
}
|
}
|
||||||
else std::cout << "Updating failed";
|
else std::cout << "Updating failed";
|
||||||
}
|
}
|
||||||
else if (EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName.c_str(), TRAINING))
|
else if (EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName.c_str(), TRAINING) == EC_OK)
|
||||||
{
|
{
|
||||||
std::cout << "Saving finished";
|
std::cout << "Saving finished";
|
||||||
}
|
}
|
||||||
@@ -132,7 +133,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
case 2:{
|
case 2:{
|
||||||
if (getNumberProfile > 0){
|
if (getNumberProfile > 0){
|
||||||
if (EC_LoadUserProfile(userCloudID, (int)engineUserID, EC_ProfileIDAtIndex(userCloudID, 0)))
|
if (EC_LoadUserProfile(userCloudID, (int)engineUserID, EC_ProfileIDAtIndex(userCloudID, 0)) == EC_OK)
|
||||||
std::cout << "Loading finished";
|
std::cout << "Loading finished";
|
||||||
else
|
else
|
||||||
std::cout << "Loading failed";
|
std::cout << "Loading failed";
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ public class SavingAndLoadingProfileCloud {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!EmotivCloudClient.INSTANCE.EC_Connect())
|
if(EmotivCloudClient.INSTANCE.EC_Connect() != EdkCloudErrorCode.EC_OK)
|
||||||
{
|
{
|
||||||
System.out.println("Cannot connect to Emotiv Cloud");
|
System.out.println("Cannot connect to Emotiv Cloud");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!EmotivCloudClient.INSTANCE.EC_Login(userName, password))
|
if(EmotivCloudClient.INSTANCE.EC_Login(userName, password) != EdkCloudErrorCode.EC_OK)
|
||||||
{
|
{
|
||||||
System.out.println("Your login attempt has failed. The username or password may be incorrect");
|
System.out.println("Your login attempt has failed. The username or password may be incorrect");
|
||||||
return;
|
return;
|
||||||
@@ -48,7 +48,7 @@ public class SavingAndLoadingProfileCloud {
|
|||||||
|
|
||||||
System.out.println("Logged in as " + userName);
|
System.out.println("Logged in as " + userName);
|
||||||
|
|
||||||
if (!EmotivCloudClient.INSTANCE.EC_GetUserDetail(userCloudID))
|
if (EmotivCloudClient.INSTANCE.EC_GetUserDetail(userCloudID) != EdkCloudErrorCode.EC_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@@ -81,12 +81,13 @@ public class SavingAndLoadingProfileCloud {
|
|||||||
|
|
||||||
if (profileID >= 0) {
|
if (profileID >= 0) {
|
||||||
System.out.println("Profile with " + profileName + " is existed");
|
System.out.println("Profile with " + profileName + " is existed");
|
||||||
if (EmotivCloudClient.INSTANCE.EC_UpdateUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileID)) {
|
if (EmotivCloudClient.INSTANCE.EC_UpdateUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileID) == EdkCloudErrorCode.EC_OK)
|
||||||
|
{
|
||||||
System.out.println("Updating finished");
|
System.out.println("Updating finished");
|
||||||
}
|
}
|
||||||
else System.out.println("Updating failed");
|
else System.out.println("Updating failed");
|
||||||
}
|
}
|
||||||
else if (EmotivCloudClient.INSTANCE.EC_SaveUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileName, 0)) // Training
|
else if (EmotivCloudClient.INSTANCE.EC_SaveUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileName, 0) == EdkCloudErrorCode.EC_OK) // Training
|
||||||
{
|
{
|
||||||
System.out.println("Saving finished");
|
System.out.println("Saving finished");
|
||||||
}
|
}
|
||||||
@@ -98,7 +99,7 @@ public class SavingAndLoadingProfileCloud {
|
|||||||
if (getNumberProfile > 0){
|
if (getNumberProfile > 0){
|
||||||
int profileID = EmotivCloudClient.INSTANCE.EC_GetProfileId(userCloudID.getValue(), profileName);
|
int profileID = EmotivCloudClient.INSTANCE.EC_GetProfileId(userCloudID.getValue(), profileName);
|
||||||
|
|
||||||
if (EmotivCloudClient.INSTANCE.EC_LoadUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileID, version))
|
if (EmotivCloudClient.INSTANCE.EC_LoadUserProfile(userCloudID.getValue(), engineUserID.getValue(), profileID, version) == EdkCloudErrorCode.EC_OK)
|
||||||
System.out.println("Loading finished");
|
System.out.println("Loading finished");
|
||||||
else
|
else
|
||||||
System.out.println("Loading failed");
|
System.out.println("Loading failed");
|
||||||
|
|||||||
@@ -85,17 +85,17 @@ if libEDK.IEE_EngineConnect("Emotiv Systems-5") != 0:
|
|||||||
|
|
||||||
option = int(raw_input())
|
option = int(raw_input())
|
||||||
|
|
||||||
if libEDK.EC_Connect() != True:
|
if libEDK.EC_Connect() != 0:
|
||||||
print "Cannot connect to Emotiv Cloud"
|
print "Cannot connect to Emotiv Cloud"
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
if libEDK.EC_Login(userName, password) != True:
|
if libEDK.EC_Login(userName, password) != 0:
|
||||||
print "Your login attempt has failed. The username or password may be incorrect"
|
print "Your login attempt has failed. The username or password may be incorrect"
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
print "Logged in as %s" % userName
|
print "Logged in as %s" % userName
|
||||||
|
|
||||||
if libEDK.EC_GetUserDetail(userCloudIDP) != True:
|
if libEDK.EC_GetUserDetail(userCloudIDP) != 0:
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@@ -117,11 +117,11 @@ while True:
|
|||||||
|
|
||||||
if profileID >= 0:
|
if profileID >= 0:
|
||||||
print "Profile with %s is existed" % profileName
|
print "Profile with %s is existed" % profileName
|
||||||
if libEDK.EC_UpdateUserProfile(userCloudID.value, userEngineID.value, profileID, profileName):
|
if libEDK.EC_UpdateUserProfile(userCloudID.value, userEngineID.value, profileID, profileName) == 0:
|
||||||
print "Updating finished"
|
print "Updating finished"
|
||||||
else:
|
else:
|
||||||
print "Updating failed"
|
print "Updating failed"
|
||||||
elif libEDK.EC_SaveUserProfile(userCloudID.value, userEngineID.value, profileName, 0): # 0: libEDK.profileType.TRAINING
|
elif libEDK.EC_SaveUserProfile(userCloudID.value, userEngineID.value, profileName, 0) == 0: # 0: libEDK.profileType.TRAINING
|
||||||
print "Saving finished"
|
print "Saving finished"
|
||||||
else:
|
else:
|
||||||
print "Saving failed"
|
print "Saving failed"
|
||||||
@@ -132,7 +132,7 @@ while True:
|
|||||||
if option == 2:
|
if option == 2:
|
||||||
if getNumberProfile > 0:
|
if getNumberProfile > 0:
|
||||||
profileID = libEDK.EC_ProfileIDAtIndex(userCloudID.value, 0)
|
profileID = libEDK.EC_ProfileIDAtIndex(userCloudID.value, 0)
|
||||||
if libEDK.EC_LoadUserProfile(userCloudID.value, userEngineID.value, profileID, version):
|
if libEDK.EC_LoadUserProfile(userCloudID.value, userEngineID.value, profileID, version) == 0:
|
||||||
print "Loading finished"
|
print "Loading finished"
|
||||||
else:
|
else:
|
||||||
print "Loading failed"
|
print "Loading failed"
|
||||||
|
|||||||
@@ -8,6 +8,61 @@ namespace Emotiv
|
|||||||
{
|
{
|
||||||
public class EmotivCloudClient
|
public class EmotivCloudClient
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//! Default success value.
|
||||||
|
public const Int32 EC_OK = 0x0000;
|
||||||
|
|
||||||
|
//! An internal error occurred.
|
||||||
|
public const Int32 EC_UNKNOWN_ERROR = 0x0001;
|
||||||
|
|
||||||
|
//! An internal error occurred.
|
||||||
|
public const Int32 EC_COULDNT_RESOLVE_PROXY = 0x0002;
|
||||||
|
|
||||||
|
public const Int32 EC_COULDNT_RESOLVE_HOST = 0x0003;
|
||||||
|
|
||||||
|
public const Int32 EC_COULDNT_CONNECT = 0x0004;
|
||||||
|
|
||||||
|
//! Profile created by EC_SaveUserProfile() is existed in Emotiv Cloud.
|
||||||
|
public const Int32 EC_PROFILE_CLOUD_EXISTED = 0x0101;
|
||||||
|
|
||||||
|
//! The buffer is not a valid, serialized EmoEngine profile.
|
||||||
|
public const Int32 EC_INVALID_PROFILE_ARCHIVE = 0x0102;
|
||||||
|
|
||||||
|
//! One of the parameters supplied to the function is invalid
|
||||||
|
public const Int32 EC_INVALID_PARAMETER = 0x0300;
|
||||||
|
|
||||||
|
//! A parameter supplied to the function is out of range.
|
||||||
|
public const Int32 EC_OUT_OF_RANGE = 0x0301;
|
||||||
|
|
||||||
|
//! A filesystem error occurred.
|
||||||
|
public const Int32 EC_FILESYSTEM_ERROR = 0x0302;
|
||||||
|
|
||||||
|
//! The buffer supplied to the function is not large enough.
|
||||||
|
public const Int32 EC_BUFFER_TOO_SMALL = 0x0303;
|
||||||
|
|
||||||
|
//! The file uploaded to cloud is failed
|
||||||
|
public const Int32 EC_UPLOAD_FAILED = 0x0304;
|
||||||
|
|
||||||
|
//! The cloud user ID supplied to the function is invalid.
|
||||||
|
public const Int32 EC_INVALID_CLOUD_USER_ID = 0x0400;
|
||||||
|
|
||||||
|
//! The user ID supplied to the function is invalid
|
||||||
|
public const Int32 EC_INVALID_ENGINE_USER_ID = 0x0401;
|
||||||
|
|
||||||
|
//! The user ID supplied to the function dont login, call EC_Login() first
|
||||||
|
public const Int32 EC_CLOUD_USER_ID_DONT_LOGIN = 0x0402;
|
||||||
|
|
||||||
|
//! The Emotiv Cloud needs to be initialized via EC_Connect()
|
||||||
|
public const Int32 EC_EMOTIVCLOUD_UNINITIALIZED = 0x0500;
|
||||||
|
|
||||||
|
//! The Emotiv Engine needs to be initialized via IEE_EngineConnect() or IEE_EngineRemoteConnect() before call EC_Connect() or Emotiv Engine is disconnected
|
||||||
|
public const Int32 EC_EMOENGINE_UNINITIALIZED = 0x0501;
|
||||||
|
|
||||||
|
public const Int32 EC_FILE_EXISTS = 0x1001;
|
||||||
|
|
||||||
|
//! Reserved return value.
|
||||||
|
public const Int32 EC_RESERVED1 = 0x0900;
|
||||||
|
|
||||||
public enum profileFileType
|
public enum profileFileType
|
||||||
{
|
{
|
||||||
TRAINING,
|
TRAINING,
|
||||||
@@ -21,43 +76,43 @@ namespace Emotiv
|
|||||||
};
|
};
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Connect")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Connect")]
|
||||||
public static extern bool EC_Connect();
|
public static extern Int32 EC_Connect();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ReconnectEngine")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ReconnectEngine")]
|
||||||
public static extern bool EC_ReconnectEngine();
|
public static extern Int32 EC_ReconnectEngine();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DisconnectEngine")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DisconnectEngine")]
|
||||||
public static extern bool EC_DisconnectEngine();
|
public static extern Int32 EC_DisconnectEngine();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Disconnect")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Disconnect")]
|
||||||
public static extern void EC_Disconnect();
|
public static extern Int32 EC_Disconnect();
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Login")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Login")]
|
||||||
public static extern bool EC_Login(String email, String password);
|
public static extern Int32 EC_Login(String email, String password);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Logout")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_Logout")]
|
||||||
public static extern bool EC_Logout(int userCloudID);
|
public static extern Int32 EC_Logout(int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetUserDetail")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetUserDetail")]
|
||||||
public static extern bool EC_GetUserDetail(ref int userCloudID);
|
public static extern Int32 EC_GetUserDetail(ref int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_SaveUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_SaveUserProfile")]
|
||||||
public static extern bool EC_SaveUserProfile(int userCloudID, int engineUserID, String profileName, profileFileType ptype);
|
public static extern Int32 EC_SaveUserProfile(int userCloudID, int engineUserID, String profileName, profileFileType ptype);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_UpdateUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_UpdateUserProfile")]
|
||||||
public static extern bool EC_UpdateUserProfile(int userCloudID, int engineUserID, int profileId);
|
public static extern Int32 EC_UpdateUserProfile(int userCloudID, int engineUserID, int profileId);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DeleteUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_DeleteUserProfile")]
|
||||||
public static extern bool EC_DeleteUserProfile(int userCloudID, int profileId);
|
public static extern Int32 EC_DeleteUserProfile(int userCloudID, int profileId);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetProfileId")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetProfileId")]
|
||||||
public static extern int EC_GetProfileId(int userCloudID, String profileName);
|
public static extern int EC_GetProfileId(int userCloudID, String profileName);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_LoadUserProfile")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_LoadUserProfile")]
|
||||||
public static extern bool EC_LoadUserProfile(int userCloudID, int engineUserID, int profileId, int version);
|
public static extern Int32 EC_LoadUserProfile(int userCloudID, int engineUserID, int profileId, int version);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetAllProfileName")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_GetAllProfileName")]
|
||||||
public static extern int EC_GetAllProfileName(int userCloudID);
|
public static extern Int32 EC_GetAllProfileName(int userCloudID);
|
||||||
|
|
||||||
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ProfileIDAtIndex")]
|
[DllImport("edk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "EC_ProfileIDAtIndex")]
|
||||||
public static extern int EC_ProfileIDAtIndex(int userCloudID, int index);
|
public static extern int EC_ProfileIDAtIndex(int userCloudID, int index);
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.emotiv.Iedk;
|
||||||
|
|
||||||
|
|
||||||
|
public enum EdkCloudErrorCode {
|
||||||
|
// ! Default success value.
|
||||||
|
EC_OK(0x0000),
|
||||||
|
|
||||||
|
// ! An internal error occurred.
|
||||||
|
EC_UNKNOWN_ERROR(0x0001),
|
||||||
|
|
||||||
|
// ! An internal error occurred.
|
||||||
|
EC_COULDNT_RESOLVE_PROXY(0x0002),
|
||||||
|
|
||||||
|
EC_COULDNT_RESOLVE_HOST(0x0003),
|
||||||
|
|
||||||
|
EC_COULDNT_CONNECT(0x0004),
|
||||||
|
|
||||||
|
// ! Profile created by EC_SaveUserProfile() is existed in Emotiv Cloud.
|
||||||
|
EC_PROFILE_CLOUD_EXISTED(0x0101),
|
||||||
|
|
||||||
|
// ! The buffer is not a valid, serialized EmoEngine profile.
|
||||||
|
EC_INVALID_PROFILE_ARCHIVE(0x0102),
|
||||||
|
|
||||||
|
// ! One of the parameters supplied to the function is invalid
|
||||||
|
EC_INVALID_PARAMETER(0x0300),
|
||||||
|
|
||||||
|
// ! A parameter supplied to the function is out of range.
|
||||||
|
EC_OUT_OF_RANGE(0x0301),
|
||||||
|
|
||||||
|
// ! A filesystem error occurred.
|
||||||
|
EC_FILESYSTEM_ERROR(0x0302),
|
||||||
|
|
||||||
|
// ! The buffer supplied to the function is not large enough.
|
||||||
|
EC_BUFFER_TOO_SMALL(0x0303),
|
||||||
|
|
||||||
|
// ! The file uploaded to cloud is failed
|
||||||
|
EC_UPLOAD_FAILED(0x0304),
|
||||||
|
|
||||||
|
// ! The cloud user ID supplied to the function is invalid.
|
||||||
|
EC_INVALID_CLOUD_USER_ID(0x0400),
|
||||||
|
|
||||||
|
// ! The user ID supplied to the function is invalid
|
||||||
|
EC_INVALID_ENGINE_USER_ID(0x0401),
|
||||||
|
|
||||||
|
// ! The user ID supplied to the function dont login, call EC_Login() first
|
||||||
|
EC_CLOUD_USER_ID_DONT_LOGIN(0x0402),
|
||||||
|
|
||||||
|
// ! The Emotiv Cloud needs to be initialized via EC_Connect()
|
||||||
|
EC_EMOTIVCLOUD_UNINITIALIZED(0x0500),
|
||||||
|
|
||||||
|
// ! The Emotiv Engine needs to be initialized via IEE_EngineConnect() or IEE_EngineRemoteConnect() before call EC_Connect() or Emotiv Engine is disconnected
|
||||||
|
EC_EMOENGINE_UNINITIALIZED(0x0501),
|
||||||
|
|
||||||
|
EC_FILE_EXISTS(0x1001),
|
||||||
|
|
||||||
|
// ! Reserved return value.
|
||||||
|
EC_RESERVED1(0x0900);
|
||||||
|
|
||||||
|
private int bit;
|
||||||
|
|
||||||
|
EdkErrorCode(int bitNumber) {
|
||||||
|
bit = bitNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ToInt() {
|
||||||
|
return (bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Antes Largura: | Altura: | Tamanho: 83 KiB Depois Largura: | Altura: | Tamanho: 51 KiB |
|
Antes Largura: | Altura: | Tamanho: 221 KiB Depois Largura: | Altura: | Tamanho: 66 KiB |
|
Antes Largura: | Altura: | Tamanho: 280 KiB Depois Largura: | Altura: | Tamanho: 82 KiB |
|
Antes Largura: | Altura: | Tamanho: 102 KiB Depois Largura: | Altura: | Tamanho: 4.4 KiB |
|
Antes Largura: | Altura: | Tamanho: 391 KiB Depois Largura: | Altura: | Tamanho: 332 KiB |
|
Antes Largura: | Altura: | Tamanho: 384 KiB Depois Largura: | Altura: | Tamanho: 343 KiB |