Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC - Living lab payment2 #565

Open
wants to merge 35 commits into
base: living_labs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4bbeb1f
Added payment2 api
andreasbotsikas Apr 20, 2013
a19c5a7
Removed bak file
andreasbotsikas Apr 20, 2013
29a7f45
Fixed indentation
andreasbotsikas Apr 20, 2013
c49c8bd
Added testbed for payment2
andreasbotsikas Apr 20, 2013
dcca575
Added android calling
andreasbotsikas Apr 20, 2013
d126d40
Removed space from closing tag
andreasbotsikas Apr 20, 2013
ed483c8
Added payment2 in grunt
andreasbotsikas Apr 22, 2013
a529bb6
Added OTF mime type
andreasbotsikas Apr 22, 2013
a5dc2bd
Added payment implementation for android
andreasbotsikas Apr 23, 2013
f711881
Fixed contacts to bring google contacts even if no thunderbird is pre…
andreasbotsikas Apr 23, 2013
a770b15
replaced wallet with a simple webinosFakewallet
andreasbotsikas Apr 24, 2013
d3ed0ab
Fixed testbed to clear previous messages before showing new response.
andreasbotsikas Apr 24, 2013
254c585
Added to send pay deny when activity pauses. Fixed debug messages.
andreasbotsikas Apr 24, 2013
74e8c5c
Fixed bugs passing bundles across activities
andreasbotsikas Apr 24, 2013
506a38c
Added debug messages in payment2
andreasbotsikas Apr 24, 2013
ad8cb02
Fixed contacts on android
Apr 26, 2013
b9e9b42
File API
Apr 29, 2013
6c032c8
app2app
Apr 29, 2013
2ac045a
Disable policy manager
Apr 29, 2013
2388ccf
File API
Apr 29, 2013
4d515a0
Wallet
Apr 29, 2013
83ae36f
Updated wallet artwork
Apr 30, 2013
8ccdc9f
Avoid crash by setting manually the config settings. This has been fi…
Apr 30, 2013
b1a869a
PZP Websocket log error
Apr 30, 2013
6dcf1a8
Marginally reduce event rate to be manageable.
paddybyers Apr 30, 2013
0e5ea86
Fix removeEventListener methods.
paddybyers Apr 30, 2013
f2c5365
Add testbed support for device motion events.
paddybyers Apr 30, 2013
ed27164
Multiple minor fixes
paddybyers Apr 30, 2013
7a41e3d
Allow getCurrentPosition() to be synchronous or asynchronous
paddybyers Apr 30, 2013
ca5f19a
Added templates for devices
May 1, 2013
02d5a12
Added 2 targets one for tv one for wallet
May 1, 2013
aadfae2
Deviceorientation check for android first
May 1, 2013
7b165c4
Added TV api on devices
May 1, 2013
e152a8d
friendly name screws the addressing. Living it blank and after a coup…
May 1, 2013
84cd98f
Added wallet ipr file
andreasbotsikas Aug 8, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = function(grunt) {
'webinos/core/wrt/lib/webinos.devicestatus.js',
'webinos/core/wrt/lib/webinos.discovery.js',
'webinos/core/wrt/lib/webinos.payment.js',
'webinos/core/wrt/lib/webinos.payment2.js',
'webinos/core/wrt/lib/webinos.mediacontent.js',
'webinos/core/wrt/lib/webinos.corePZinformation.js',
'webinos/core/wrt/lib/webinos.nfc.js',
Expand Down
13 changes: 11 additions & 2 deletions webinos/core/api/app2app/lib/app2app.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@
if (registeredChannels.hasOwnProperty(namespace)) {
// channel already exists; check if request is from the same session; if yes assume reconnect
var existingChannel = registeredChannels[namespace];
if (sessionId === existingChannel.creator.sessionId && reclaimIfExists) {
var mysessionId = sessionId.split("//");
mysessionId[mysessionId.length-1] = mysessionId[mysessionId.length-1].split("_")[0];
mysessionId = mysessionId.join("//");
var mycreatorid = existingChannel.creator.sessionId.split("//");
mycreatorid[mycreatorid.length-1] = mycreatorid[mycreatorid.length-1].split("_")[0];
mycreatorid = mycreatorid.join("//");

// if (sessionId === existingChannel.creator.sessionId && reclaimIfExists) {
if (mysessionId === mycreatorid && reclaimIfExists) {
console.log("Reconnecting channel creator to channel with namespace " + namespace);

// refresh client bindings, but keep existing configuration
Expand Down Expand Up @@ -250,8 +258,9 @@
return;
}

//ABOT HACK
// send connect request to channel creator, if callback is provided
if (channel.creator.hasRequestCallback) {
if (false){//channel.creator.hasRequestCallback) {
var peerRef = registeredPeers[channel.creator.peerId];

var rpc = this.rpcHandler.createRPC(peerRef, "handleConnectRequest", connectRequest);
Expand Down
16 changes: 12 additions & 4 deletions webinos/core/api/contacts/lib/contacts_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ function makeW3Ccontacts(successCB, errorCB)
var rawContacts;
var wID = webinos.global.require (webinos.global.pzp.location).getDeviceName();
var pzpJsonPath = wPath + "/userData/" + wID + ".json";
var pzp_json = require(pzpJsonPath);
var pzp_json = {};
try{
pzp_json = require(pzpJsonPath);
}catch(e){
}

if ( !pzp_json.abook || pzp_json.abook === "")
{
// Is this the first time we search for an abook setting?
Expand Down Expand Up @@ -169,6 +174,10 @@ function makeW3Ccontacts(successCB, errorCB)

contacts_l = JSON.parse(JSON.stringify(contacts_l));
successCB(contacts_l);
}else if (fs.existsSync(contactsPath)){ // Return google cached contacts
var contacts_g = fs.readFileSync(contactsPath, 'utf8');
contacts_g = JSON.parse(contacts_g);
successCB(contacts_g);
}
else if (errorCB)
errorCB(this.NOT_FOUND_ERROR);
Expand Down Expand Up @@ -372,9 +381,8 @@ this.findContacts = function(filters, successCB, errorCB)
else //on Android
{
console.log("---FIND: android, local");
if(!options)
options=new Array();
LocalContacts.find(fields, successCB, function(){}, options);
var options=new Array();
LocalContacts.find({}, successCB, function(){}, options);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
******************************************************************************/
(function () {

var remove = function(arr, val) {
var idx = arr.indexOf(val);
if(idx != -1)
arr.splice(idx, 1);
};

var rpcHandler = null;

// device info
Expand Down Expand Up @@ -79,11 +85,11 @@ function removeEventListener(params, successCB, errorCB, objectRef) {
switch (params[1]) {
case "devicemotion":
if (listeningToDeviceMotion) {
var n = objectRefs["devicemotion"].length;
for (var i = 0; i < n; i++) {
if (objectRefs["devicemotion"][i] === params[0])
objectRefs["devicemotion"].splice(i, 1);
}
var idx = objectRefs["devicemotion"].length;
while(idx-- > 0) {
if(objectRefs["devicemotion"][idx].rpcId == params[0])
objectRefs["devicemotion"].splice(idx, 1);
}
if (objectRefs["devicemotion"].length === 0) {
orientation.unwatchMotion();
listeningToDeviceMotion = false;
Expand All @@ -92,11 +98,11 @@ function removeEventListener(params, successCB, errorCB, objectRef) {
break;
case "deviceorientation":
if (listeningToDeviceOrientation) {
var n = objectRefs["deviceorientation"].length;
for (var i = 0; i < n; i++) {
if (objectRefs["deviceorientation"][i] === params[0])
objectRefs["deviceorientation"].splice(i, 1);
}
var idx = objectRefs["deviceorientation"].length;
while(idx-- > 0) {
if(objectRefs["deviceorientation"][idx].rpcId == params[0])
objectRefs["deviceorientation"].splice(idx, 1);
}
if (objectRefs["deviceorientation"].length === 0) {
orientation.unwatchOrientation();
listeningToDeviceOrientation = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ var RPCWebinosService = require('webinos-jsonrpc2').RPCWebinosService;
function DeviceOrientationModule(rpcHandler, params) {
var car, implFile = 'fake';
var connector = params.connector;
if(connector == 'most'){
if(process.platform=='android')
{
implFile = 'android';
console.log('connecting to android impl');
}else if(connector == 'most'){
try{
var vehicleSystem = require('../../vehicle/contrib/vb-con/vc.js');
vehicleBusAvailable = vehicleSystem.available;
Expand All @@ -44,10 +48,7 @@ function DeviceOrientationModule(rpcHandler, params) {
console.log('connecting to fake data generator');
}

if(process.platform=='android')
{
implFile = 'android';
}



var implModule = require('./webinos.deviceorientation.' + implFile + '.js');
Expand Down
6 changes: 4 additions & 2 deletions webinos/core/api/file/lib/fs/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ var links = {}
var app = express()
app.get("/media/:ref", function (request, response) {
if (links[request.params.ref]) {
response.sendfile(links[request.params.ref])
response.sendfile(links[request.params.ref], function(err){
console.log(JSON.stringify(err,null," "));
})
} else {
response.send(404)
}
Expand All @@ -87,7 +89,7 @@ LocalFileSystem.hostname = null
LocalFileSystem.init = function (port, hostname) {
LocalFileSystem.port = port
LocalFileSystem.hostname = hostname
app.listen(port, hostname)
app.listen(port, "0.0.0.0")
}

LocalFileSystem.prototype.type = "local"
Expand Down
26 changes: 24 additions & 2 deletions webinos/core/api/geolocation/lib/webinos.geolocation.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,34 @@ try {
console.log("error loading native android module: " + e);
}

function getCurrentPosition (params, successCB, errorCB){
function getCurrentPosition (params, successCB, errorCB, objectRef){
if(!androidImpl) {
errorCB(new Error('Android geolocation service not available'));
return;
}
androidImpl.getCurrentPosition(successCB, errorCB, params);
var inCall;
var implSuccess = function(position) {
if(inCall) {
successCB(position);
return;
}
/* it will complete asynchronously */
var rpc = rpcHandler.createRPC(objectRef, 'onEvent', position);
rpcHandler.executeRPC(rpc);
};
var implErr = function(err) {

if(inCall) {
errorCB(err);
return;
}
/* it will complete asynchronously */
var rpc = rpcHandler.createRPC(objectRef, 'onError', err);
rpcHandler.executeRPC(rpc);
};
inCall = true;
androidImpl.getCurrentPosition(implSuccess, implErr, params);
inCall = false;
}

function watchPosition (args, successCB, errorCB, objectRef) {
Expand Down
4 changes: 4 additions & 0 deletions webinos/core/api/payment2/dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ "root": {
"location": "../../"
}
}
Loading