Skip to content
Snippets Groups Projects
Commit 10f6af46 authored by Asad Salman's avatar Asad Salman
Browse files

nodejs: changes for electron compatibility

Change-Id: Icfb6ca3858450eaf2b5bbfbb16fcc024c8c9d772
parent b45d73c9
No related branches found
No related tags found
No related merge requests found
...@@ -9,11 +9,11 @@ ring_wrapper.cpp: nodejs_interface.i configurationmanager.i managerimpl.i ...@@ -9,11 +9,11 @@ ring_wrapper.cpp: nodejs_interface.i configurationmanager.i managerimpl.i
$(SWIG) -v -c++ -javascript -node -o ring_wrapper.cpp nodejs_interface.i $(SWIG) -v -c++ -javascript -node -o ring_wrapper.cpp nodejs_interface.i
build/Makefile: ring_wrapper.cpp binding.gyp build/Makefile: ring_wrapper.cpp binding.gyp
node-gyp configure node-gyp configure --target=1.6.2 --arch=x64 --dist-url=https://atom.io/download/electron
build/Release/obj.target/dring.node: build/Makefile ring_wrapper.cpp callback.h build/Release/obj.target/dring.node: build/Makefile ring_wrapper.cpp callback.h
node-gyp build node-gyp build
CLEANFILES= \ CLEANFILES= \
$(BUILT_SOURCES) \ $(BUILT_SOURCES) \
build/Release/dring.node build/Release/dring.node
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
class RingDaemon{ class RingDaemon{
constructor(callbackMap) { constructor(callbackMap) {
if(callbackMap){ if(callbackMap){
this.dring = require("./build/Release/dring"); this.dring = require("./build/Release/dring.node");
this.dring.init(callbackMap); this.dring.init(callbackMap);
var that = this; var that = this;
this.pollIntervalId = setInterval(function () { this.pollIntervalId = setInterval(function () {
...@@ -92,16 +92,18 @@ class RingDaemon{ ...@@ -92,16 +92,18 @@ class RingDaemon{
this.dring.addAccount(params); this.dring.addAccount(params);
} }
stringVectToArr(stringvect){
var outputArr = [];
for(var i=0; i<stringvect.size(); i++)
outputArr.push(stringvect.get(i));
return outputArr;
}
getAccountList(){
return this.stringVectToArr(this.dring.getAccountList());
}
getAudioOutputDeviceList() { getAudioOutputDeviceList() {
var devicesVect = this.dring.getAudioOutputDeviceList(); return this.stringVectToArr(this.dring.getAudioOutputDeviceList());
var outputDevices = [];
for(var i=0; i<devicesVect.size(); i++)
outputDevices.push(devicesVect.get(i));
return outputDevices;
} }
getVolume(deviceName) { getVolume(deviceName) {
return this.dring.getVolume(deviceName); return this.dring.getVolume(deviceName);
} }
...@@ -116,9 +118,4 @@ class RingDaemon{ ...@@ -116,9 +118,4 @@ class RingDaemon{
} }
} }
var f = function(){ module.exports = RingDaemon;
console.log("RegistrationStateChanged JS"); \ No newline at end of file
};
var daemon = new RingDaemon({"RegistrationStateChanged": f});
//daemon.stop();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment