Commit 37e3009a authored by legoc's avatar legoc
Browse files

Adaptation to cameo 1.0

parent 39f5617f
......@@ -37,36 +37,33 @@ void Init(const FunctionCallbackInfo<Value>& args) {
// Get the V8 isolate.
v8Isolate = args.GetIsolate();
// Get the args.
// Local endpoint.
v8::String::Utf8Value param1(args[0]->ToString());
string arg1(*param1);
// We only need the last argument that we convert to an array.
char *argv[1] = {(char *)arg1.c_str()};
string localEndpoint(*param1);
// Initialise the Nomad accessor.
accessor.init(1, argv);
accessor.init("vEXP", localEndpoint);
// Nomad endpoint.
v8::String::Utf8Value param2(args[1]->ToString());
string arg2(*param2);
string nomadEndpoint(*param2);
// Connect to a nomad sim depending on the size of the args.
if (args.Length() > 2) {
// Interpret the arg 2 in string because it comes from the command line and is not a V8 integer.
v8::String::Utf8Value param3(args[3]->ToString());
string electronArgs2(*param3);
string arg3(*param3);
istringstream is(electronArgs2);
istringstream is(arg3);
int id;
is >> id;
accessor.connectNomadServerSim(arg2, id);
accessor.connectNomadServerSim(nomadEndpoint, id);
}
else {
accessor.connectNomadServer(arg2);
accessor.connectNomadServer(nomadEndpoint);
}
args.GetReturnValue().Set(Undefined(v8Isolate));
......
......@@ -46,42 +46,18 @@ void Init(const FunctionCallbackInfo<Value>& args) {
// Get the V8 isolate.
v8Isolate = args.GetIsolate();
// Get the args.
// Local endpoint.
v8::String::Utf8Value param1(args[0]->ToString());
string electronArgs(*param1);
string localEndpoint(*param1);
cout << "electron args = " << electronArgs << endl;
size_t pos = 0;
// Parse the args.
size_t endPos = electronArgs.find_first_of(',', pos);
string localEndpoint = electronArgs.substr(pos, endPos - pos);
cout << "local endpoint = " << localEndpoint << endl;
pos = endPos + 1;
endPos = electronArgs.find_first_of(',', pos);
nomadEndpoint = electronArgs.substr(pos, endPos - pos);
cout << "nomad endpoint = " << nomadEndpoint << endl;
pos = endPos + 1;
endPos = electronArgs.find_first_of(',', pos);
string name = electronArgs.substr(pos, endPos - pos + 1);
cout << "name = " << name << endl;
// Nomad endpoint.
v8::String::Utf8Value param2(args[1]->ToString());
string nomadEndpoint(*param2);
// Init the app if it is not already done.
if (cameo::application::This::getId() == -1) {
// Create the params.
string localParams = localEndpoint + ":" + name;
// We only need the last argument that we convert to an array.
char *argv[1] = {(char *)localParams.c_str()};
cameo::application::This::init(1, argv);
cameo::application::This::init("vEXP", localEndpoint);
cout << "initialised cameo" << endl;
}
......
......@@ -10,10 +10,10 @@ class NomadDataAccessor {
this._nomadAccessor = require("../../build/Release/addoncameonomad");
try {
if (id == -1) {
this._nomadAccessor.init(config.localEndpoint + ":vEXP", config.nomadEndpoint);
this._nomadAccessor.init(config.localEndpoint, config.nomadEndpoint);
}
else {
this._nomadAccessor.init(config.localEndpoint + ":vEXP", config.nomadEndpoint, id);
this._nomadAccessor.init(config.localEndpoint, config.nomadEndpoint, id);
}
} catch (e) {
......
......@@ -13,7 +13,7 @@ class VEXPSpy {
// Init the addon.
VEXPSpyData = require('../../build/Release/addonvexpspy');
VEXPSpyData.init([config.localEndpoint, config.nomadEndpoint, "vEXP"]);
VEXPSpyData.init(config.localEndpoint, config.nomadEndpoint);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment