diff --git a/Gruntfile.js b/Gruntfile.js index a5d8cef2..f3f2afd2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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', diff --git a/webinos/core/api/app2app/lib/app2app.js b/webinos/core/api/app2app/lib/app2app.js index 1bef0bcf..df3560ad 100644 --- a/webinos/core/api/app2app/lib/app2app.js +++ b/webinos/core/api/app2app/lib/app2app.js @@ -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 @@ -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); diff --git a/webinos/core/api/contacts/lib/contacts_modules.js b/webinos/core/api/contacts/lib/contacts_modules.js index 9b819d6f..2508304a 100644 --- a/webinos/core/api/contacts/lib/contacts_modules.js +++ b/webinos/core/api/contacts/lib/contacts_modules.js @@ -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? @@ -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); @@ -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); } }; diff --git a/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.android.js b/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.android.js index e1c50f18..8216eccc 100644 --- a/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.android.js +++ b/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.android.js @@ -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 @@ -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; @@ -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; diff --git a/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.rpc.js b/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.rpc.js index 8da7aeed..59b0db7d 100644 --- a/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.rpc.js +++ b/webinos/core/api/deviceorientation/lib/webinos.deviceorientation.rpc.js @@ -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; @@ -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'); diff --git a/webinos/core/api/file/lib/fs/local.js b/webinos/core/api/file/lib/fs/local.js index c9e47470..5f8b08fa 100644 --- a/webinos/core/api/file/lib/fs/local.js +++ b/webinos/core/api/file/lib/fs/local.js @@ -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) } @@ -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" diff --git a/webinos/core/api/geolocation/lib/webinos.geolocation.android.js b/webinos/core/api/geolocation/lib/webinos.geolocation.android.js index d49c66ef..41455303 100644 --- a/webinos/core/api/geolocation/lib/webinos.geolocation.android.js +++ b/webinos/core/api/geolocation/lib/webinos.geolocation.android.js @@ -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) { diff --git a/webinos/core/api/payment2/dependencies.json b/webinos/core/api/payment2/dependencies.json new file mode 100644 index 00000000..60e4dee5 --- /dev/null +++ b/webinos/core/api/payment2/dependencies.json @@ -0,0 +1,4 @@ +{ "root": { + "location": "../../" + } +} \ No newline at end of file diff --git a/webinos/core/api/payment2/lib/impl_payment2.js b/webinos/core/api/payment2/lib/impl_payment2.js new file mode 100644 index 00000000..20a6fce9 --- /dev/null +++ b/webinos/core/api/payment2/lib/impl_payment2.js @@ -0,0 +1,321 @@ + /******************************************************************************* + * Code contributed to the webinos project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2012 Christian Fuhrhop, Fraunhofer FOKUS + * + ******************************************************************************/ +/** + * Interface for Payment functions. + * + * + * This API provides generic shopping basket functionality to provide in-app payment. + * + * It is not linked to a specific payment service provider and is designed to be + * sufficiently generic to be mapable to various payment services like GSMA OneAPI, + * Andoid Payment API or PayPal. + * + */ + + //making namespaces + if (typeof webinos === "undefined") { webinos = {}; } + if (!webinos.payment2) { webinos.payment2 = {}; } + + /** + * The WebinosPayment interface describes the part of the payment API accessible through the webinos object. + * + */ + WebinosPayment2 = function () { + + this.payment2 = new Payment2(); + }; + + /** + * webinos.payment2 object. + * + */ + WebinosPayment2.prototype.payment2 = null; + + /** + * The ShoppingItem captures the attributes of a single shopping product + * + * + * The shopping basket represents a current payment action and allows to + * add a number of items to the basket before proceeding to checkout. + * + */ + ShoppingItem = function () { + + // initialize attributes + + this.productID = ""; + this.description = ""; + this.currency = "EUR"; + this.itemPrice = 0.0; + this.itemCount = 0; + this.itemsPrice = 0.0; + }; + + /** + * An id that allows the shop to identify the purchased item + * + * + * No exceptions + * + */ + ShoppingItem.prototype.productID = "" + + /** + * A human-readable text to appear on the bill, so the user can easily see what they bought. + * + * + * No exceptions + * + */ + ShoppingItem.prototype.description = ""; + + /** + * The 3-figure code as per ISO 4217. + * + * + * No exceptions + * + */ + ShoppingItem.prototype.currency = "EUR"; + + /** + * The price per individual item in the currency given above, a negative number represents a refund. + * + * + * No exceptions + * + */ + ShoppingItem.prototype.itemPrice = 0.0; + + /** + * The number of identical items purchased + * + * + * No exceptions + * + */ + ShoppingItem.prototype.itemCount = 0; + + /** + * Price for all products in this shopping item. + * + * + * Typically this is itemPrice*itemCount, but special '3 for 2' rebates might apply. + * + * Updated by the shopping basket update function. + * + * No exceptions + * + */ + ShoppingItem.prototype.itemsPrice = 0.0; + + + /** + * Callback for successful payment related functions + * + */ + Payment2SuccessCB = function () { + //TODO implement constructor logic if needed! + + }; + + /** + * Callback for successful of payment related functions + * + */ + Payment2SuccessCB.prototype.onSuccess = function (proofOfPurchase) { + //TODO: Add your application logic here! + + return; + }; + + /** + * Callback for errors during payment related functions + * + */ + Payment2ErrorCB = function () { + //TODO implement constructor logic if needed! + + }; + + /** + * Callback for errors during payment related functions + * + */ + Payment2ErrorCB.prototype.onError = function (error) { + //TODO: Add your application logic here! + + return; + }; + + /** + * The PendingOperation interface + * + * + * The PendingOperation interface describes objects that are returned by asynchronous methods that are cancellable. It makes it possible to bring + * these operations to a stop if they haven't produced a result within a desired time or before a given event, thereby possibly reclaiming resources. + * + */ + PendingOperation = function () { + //TODO implement constructor logic if needed! + + }; + + /** + * Method Cancel + * + * + * Cancel the pending asynchronous operation. When this method is called, the user agent must immediately bring the operation to a stop and return. No success or error callback for the pending operation will be invoked. + * + */ + PendingOperation.prototype.cancel = function () { + //TODO: Add your application logic here! + + return; + }; + + /** + * Payment specific errors. + * + * + * The PaymentError interface encapsulates all errors in the manipulation of payments objects in the Payment API. + * + */ + Payment2Error = function () { + //TODO implement constructor logic if needed! + + //TODO initialize attributes + + this.code = Number; + this.message = String; + this.retryPossible = Boolean; + }; + + /** + * Bill is already open + * + */ + Payment2Error.prototype.PAYMENT_SHOPPING_BASKET_OPEN_ERROR = 1; + + /** + * Bill is not open + * + */ + Payment2Error.prototype.PAYMENT_SHOPPING_BASKET_NOT_OPEN_ERROR = 2; + + /** + * Charging operation failed, the charge was not applied + * + */ + Payment2Error.prototype.PAYMENT_CHARGE_FAILED = 3; + + /** + * Refunds not supported + * + */ + Payment2Error.prototype.PAYMENT_REFUND_NOT_SUPPORTED = 4; + + /** + * Refund failed + * + */ + Payment2Error.prototype.PAYMENT_REFUND_FAILED = 5; + + /** + * Chargeable amount exceeded + * + */ + Payment2Error.prototype.PAYMENT_CHARGEABLE_EXCEEDED = 6; + + /** + * Chargeable Authentication failed. Payment credentials are incorrect. + * + */ + Payment2Error.prototype.PAYMENT_AUTHENTICATION_FAILED = 7; + + /** + * An error code assigned by an implementation when an error has occurred in Payment processing. + * + * + * No exceptions. + * + */ + Payment2Error.prototype.code = Number; + + /** + * A text describing an error occuring in the Payment in human readable form. + * + * + * No exceptions. + * + */ + Payment2Error.prototype.message = String; + + /** + * A text describing an whether an error might be recoverable on subsequent tries + * + * + * No exceptions. + * + */ + Payment2Error.prototype.retryPossible = Boolean; + + /** + * The Payment interface + * + * + * The Payment interface provides access to payment functionality. + * + * + */ + Payment2 = function () { + //TODO implement constructor logic if needed! + + }; + webinos.payment2 = new Payment2(); + + /** + * Pay a bill + * + */ + webinos.payment2.pay = function (successCallback, errorCallback, challengeCallback, itemList, bill, customerID, sellerID) { + console.log("Implementation of webinos.payment2.pay called"); + + // cover a number of possible error conditions + error = {}; + if((sellerID==null)||(sellerID.length==0)) { + error.code = Payment2Error.prototype.PAYMENT_AUTHENTICATION_FAILED; + error.message = "Failed to provide seller ID"; + errorCallback(error); + return new PendingOperation(); + } + if((customerID==null)||(customerID==0)) { + error.code = Payment2Error.prototype.PAYMENT_AUTHENTICATION_FAILED; + error.message = "Failed to provide customer ID"; + errorCallback(error); + return new PendingOperation(); + } + + // Everything is fine - perform the payment + successCallback("Payment of "+bill.itemPrice+" "+bill.currency+" performed on bill "+bill.productID); + return new PendingOperation(); + }; + +exports.pay = webinos.payment2.pay; + diff --git a/webinos/core/api/payment2/lib/rpc_payment2.js b/webinos/core/api/payment2/lib/rpc_payment2.js new file mode 100644 index 00000000..c7ef7271 --- /dev/null +++ b/webinos/core/api/payment2/lib/rpc_payment2.js @@ -0,0 +1,79 @@ + /******************************************************************************* + * Code contributed to the webinos project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2012 Christian Fuhrhop, Fraunhofer FOKUS + * + ******************************************************************************/ + + (function() { + +var wPayment2; +if(process.platform === 'android') + wPayment2 = require('bridge').load('org.webinos.impl.PaymentImpl', this); +else + wPayment2 = require('./impl_payment2.js'); +var RPCWebinosService = require('webinos-jsonrpc2').RPCWebinosService; + + +/** + * Webinos Service constructor. + * @constructor + * @alias Payment2Module + * @param rpcHandler A handler for functions that use RPC to deliver their result. + */ +var Payment2Module = function(rpcHandler, params) { + // inherit from RPCWebinosService + this.base = RPCWebinosService; + this.base({ + api:'http://webinos.org/api/payment2', + displayName:'payment2', + description:'A Webinos Payment2 API.' + }); +}; + + + +Payment2Module.prototype = new RPCWebinosService; + +/** + * Pays a bill + * @param params Array of strings consisting of itemList, bill, customerID, shopID, callback- in that order. + * @param successCallback Issued when the shopping basket is created. + * @param errorCallback Issued if an error occurs during the creation of the + * shopping basket. + */ +Payment2Module.prototype.pay = function ( params, successCallback, errorCallback){ + + console.log("pay2 called on rpc receiver "+ params[0] +" "+ params[1]+" "+ params[2] ); + console.log("Bill item is:"); + console.log(JSON.stringify(params,null," ") ); + wPayment2.pay( + function (result){ + successCallback(result); + }, + function (error){ + errorCallback(error); + }, + params[4], + params[0], params[1], params[2], params[3] + ); + +}; + + +//export our object +exports.Service = Payment2Module; + +})(); diff --git a/webinos/core/api/payment2/package.json b/webinos/core/api/payment2/package.json new file mode 100644 index 00000000..6698839f --- /dev/null +++ b/webinos/core/api/payment2/package.json @@ -0,0 +1,25 @@ +{ "name": "payment" +, "publishConfig": { "tag": "alpha" } +, "description": "Payment2 API" +, "keywords": [ "webinos", "payment2", "API"] +, "version": "0.0.1" +, "homepage": "http://webinos.org/" +, "author": "Christian Fuhrhop " +, "repository": + { "type": "git" + , "url": "http://dev.webinos.org/git/wp4.git" + } +, "bugs": + { "email": "webinos-wp4-ml@fokus.fraunhofer.de" + , "url": "" + } +, "directories": { "lib": "./lib" + } +, "main": "./lib/rpc_payment2.js" +, "dependencies": + { + } +, "bundleDependencies": + [ + ] +} diff --git a/webinos/core/api/payment2/pom.xml b/webinos/core/api/payment2/pom.xml new file mode 100644 index 00000000..45fd23c4 --- /dev/null +++ b/webinos/core/api/payment2/pom.xml @@ -0,0 +1,79 @@ + + + org.webinos + api + 1.0-SNAPSHOT + + + 4.0.0 + + payment2 + pom + + Payment2 + http://www.webinos.org + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + jslint-validation + + run + + + + + + org.codehaus.mojo + exec-maven-plugin + + + + + + + + jsdoc + + exec + + + + + + + + + diff --git a/webinos/core/dependencies.json b/webinos/core/dependencies.json index 62709bbf..639adc07 100644 --- a/webinos/core/dependencies.json +++ b/webinos/core/dependencies.json @@ -80,6 +80,10 @@ "name" :"Payment", "location":"api/payment/" }, + "payment2" :{ + "name" :"Payment2", + "location":"api/payment2/" + }, "discovery" :{ "name" :"Discovery", "location":"api/discovery/" diff --git a/webinos/core/pzp/lib/pzp_otherManager.js b/webinos/core/pzp/lib/pzp_otherManager.js index 433e27af..ba881914 100644 --- a/webinos/core/pzp/lib/pzp_otherManager.js +++ b/webinos/core/pzp/lib/pzp_otherManager.js @@ -187,8 +187,8 @@ var Pzp_OtherManager = function (_parent) { modLoader.loadServiceModules (_parent.config.serviceCache, self.registry, self.rpcHandler); // load specified modules self.messageHandler = new MessageHandler (self.rpcHandler); // handler for all things message // Init the rpc interception of policy manager - dependency.global.require (dependency.global.manager.policy_manager.location, "lib/rpcInterception.js").setRPCHandler (self.rpcHandler); - dependency.global.require (dependency.global.manager.context_manager.location);//initializes context manager + //dependency.global.require (dependency.global.manager.policy_manager.location, "lib/rpcInterception.js").setRPCHandler (self.rpcHandler); + //dependency.global.require (dependency.global.manager.context_manager.location);//initializes context manager }; /** diff --git a/webinos/core/pzp/lib/pzp_websocket.js b/webinos/core/pzp/lib/pzp_websocket.js index 90d486f5..87f06eaf 100644 --- a/webinos/core/pzp/lib/pzp_websocket.js +++ b/webinos/core/pzp/lib/pzp_websocket.js @@ -757,7 +757,7 @@ var PzpWSS = function (parent) { connectedWebApp[address].socket.pause (); connectedWebApp[address].sendUTF(jsonString); } catch (err) { - self.pzp_state.logger.error ("exception in sending message to pzp - " + err); + logger.error ("exception in sending message to pzp - " + err); } finally { logger.log ('send to web app - ' + address + ' message ' + jsonString); connectedWebApp[address].socket.resume (); diff --git a/webinos/core/util/lib/content.js b/webinos/core/util/lib/content.js index 95921a60..8119219a 100644 --- a/webinos/core/util/lib/content.js +++ b/webinos/core/util/lib/content.js @@ -56,6 +56,9 @@ exports.getContentType = function (uri) { case ".wav": contentType = "video/x-ms-wmv"; break; + case ".otf": + contentType = "font/opentype"; + break; } return {"Content-Type": contentType}; }; diff --git a/webinos/core/wrt/lib/webinos.file.js b/webinos/core/wrt/lib/webinos.file.js index 5d297a83..05c957d6 100644 --- a/webinos/core/wrt/lib/webinos.file.js +++ b/webinos/core/wrt/lib/webinos.file.js @@ -197,9 +197,9 @@ if (typeof webinos.file === "undefined") webinos.file = {}; } }); - successCallback(next()); + successCallback(self.entries ); }, errorCallback); - } else webinos.util.async(successCallback)(next()); + } else webinos.util.async(successCallback)(self.entries); }; webinos.util.inherits(FileEntry, Entry); diff --git a/webinos/core/wrt/lib/webinos.geolocation.js b/webinos/core/wrt/lib/webinos.geolocation.js index ce58f6e6..5396a0bd 100644 --- a/webinos/core/wrt/lib/webinos.geolocation.js +++ b/webinos/core/wrt/lib/webinos.geolocation.js @@ -50,14 +50,28 @@ WebinosGeolocation.prototype.bindService = function (bindCB, serviceId) { * @param positionErrorCB Error callback. * @param positionOptions Optional options. */ -function getCurrentPosition(positionCB, positionErrorCB, positionOptions) { +function getCurrentPosition(positionCB, positionErrorCB, positionOptions) { var rpc = webinos.rpcHandler.createRPC(this, "getCurrentPosition", positionOptions); // RPC service name, function, position options + webinos.rpcHandler.registerCallbackObject(rpc); + var syncResponse = false; webinos.rpcHandler.executeRPC(rpc, function (position) { + syncResponse = true; positionCB(position); }, function (error) { + syncResponse = true; positionErrorCB(error); }); + if(syncResponse) { + webinos.rpcHandler.unregisterCallbackObject(rpc.id); + return; + } + rpc.onEvent = function (position) { + positionCB(position); + }; + rpc.onError = function (err) { + positionErrorCB(err); + }; }; var watchIdTable = {}; diff --git a/webinos/core/wrt/lib/webinos.payment2.js b/webinos/core/wrt/lib/webinos.payment2.js new file mode 100644 index 00000000..01fca665 --- /dev/null +++ b/webinos/core/wrt/lib/webinos.payment2.js @@ -0,0 +1,60 @@ +/******************************************************************************* +* Code contributed to the webinos project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2012 Christian Fuhrhop, Fraunhofer FOKUS +******************************************************************************/ + +(function() { + //Payment2 Module Functionality + + Payment2Module = function (obj){ + this.base = WebinosService; + this.base(obj); + }; + + + Payment2Module.prototype = new WebinosService; + + /** + * To bind the service. + * @param bindCB BindCallback object. + */ + Payment2Module.prototype.bindService = function (bindCB, serviceId) { + this.listenAttr = {}; + + if (typeof bindCB.onBind === 'function') { + bindCB.onBind(this); + }; + } + + + Payment2Module.prototype.pay = function (successCallback, errorCallback, challengeCallback, itemList, bill, customerID, sellerID) + { + + var arguments = new Array(); + arguments[0]=itemList; + arguments[1]=bill; + arguments[2]=customerID; + arguments[3]=sellerID; + arguments[4]=challengeCallback; + var self = this; + var rpc = webinos.rpcHandler.createRPC(this, "pay", arguments); + webinos.rpcHandler.executeRPC(rpc, + function (params){successCallback(params);}, + function (error){errorCallback(error);} + ); + } + +}()); diff --git a/webinos/core/wrt/lib/webinos.servicedisco.js b/webinos/core/wrt/lib/webinos.servicedisco.js index 705181e3..9626b66e 100644 --- a/webinos/core/wrt/lib/webinos.servicedisco.js +++ b/webinos/core/wrt/lib/webinos.servicedisco.js @@ -52,6 +52,7 @@ if (typeof WebNotificationModule !== 'undefined') typeMap['http://webinos.org/api/notifications'] = WebNotificationModule; if (typeof WebinosDeviceOrientation !== 'undefined') typeMap['http://webinos.org/api/deviceorientation'] = WebinosDeviceOrientation; if (typeof PaymentModule !== 'undefined') typeMap['http://webinos.org/api/payment'] = PaymentModule; + if (typeof Payment2Module !== 'undefined') typeMap['http://webinos.org/api/payment2'] = Payment2Module; if (typeof Sensor !== 'undefined') typeMap['http://webinos.org/api/sensors'] = Sensor; if (typeof TestModule !== 'undefined') typeMap['http://webinos.org/api/test'] = TestModule; if (typeof TVManager !== 'undefined') typeMap['http://webinos.org/api/tv'] = TVManager; diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_PaymentError.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_PaymentError.java new file mode 100644 index 00000000..a6011199 --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_PaymentError.java @@ -0,0 +1,24 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.dict; + +public final class Org_webinos_api_payment_PaymentError { + + private static Object[] __args = new Object[3]; + + public static Object[] __getArgs() { return __args; } + + public static void __import(org.webinos.api.payment.PaymentError ob, Object[] vals) { + ob.code = (String)vals[0]; + ob.message = (String)vals[1]; + ob.permanent = ((org.meshpoint.anode.js.JSValue)vals[2]).getBooleanValue(); + } + + public static Object[] __export(org.webinos.api.payment.PaymentError ob) { + __args[0] = ob.code; + __args[1] = ob.message; + __args[2] = org.meshpoint.anode.js.JSValue.asJSBoolean(ob.permanent); + return __args; + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_ShoppingItem.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_ShoppingItem.java new file mode 100644 index 00000000..926055d9 --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/dict/Org_webinos_api_payment_ShoppingItem.java @@ -0,0 +1,26 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.dict; + +public final class Org_webinos_api_payment_ShoppingItem { + + private static Object[] __args = new Object[4]; + + public static Object[] __getArgs() { return __args; } + + public static void __import(org.webinos.api.payment.ShoppingItem ob, Object[] vals) { + ob.currency = (String)vals[0]; + ob.description = (String)vals[1]; + ob.itemCount = (int)((org.meshpoint.anode.js.JSValue)vals[2]).longValue; + ob.productID = (String)vals[3]; + } + + public static Object[] __export(org.webinos.api.payment.ShoppingItem ob) { + __args[0] = ob.currency; + __args[1] = ob.description; + __args[2] = org.meshpoint.anode.js.JSValue.asJSNumber((long)ob.itemCount); + __args[3] = ob.productID; + return __args; + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentChallengeType.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentChallengeType.java new file mode 100644 index 00000000..6a0ab6bc --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentChallengeType.java @@ -0,0 +1,35 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.platform; + +public final class Org_webinos_api_payment_PaymentChallengeType { + + private static Object[] __args = new Object[0]; + + public static Object[] __getArgs() { return __args; } + + static Object __get(org.webinos.api.payment.PaymentChallengeType inst, int attrIdx) { + Object result = null; + switch(attrIdx) { + case 0: /* IMAGE */ + result = org.webinos.api.payment.PaymentChallengeType.IMAGE; + break; + case 1: /* TEXT */ + result = org.webinos.api.payment.PaymentChallengeType.TEXT; + break; + case 2: /* URL */ + result = org.webinos.api.payment.PaymentChallengeType.URL; + break; + default: + } + return result; + } + + static void __set(org.webinos.api.payment.PaymentChallengeType inst, int attrIdx, Object val) { + switch(attrIdx) { + default: + throw new UnsupportedOperationException(); + } + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentErrors.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentErrors.java new file mode 100644 index 00000000..946f7c6c --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentErrors.java @@ -0,0 +1,44 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.platform; + +public final class Org_webinos_api_payment_PaymentErrors { + + private static Object[] __args = new Object[0]; + + public static Object[] __getArgs() { return __args; } + + static Object __get(org.webinos.api.payment.PaymentErrors inst, int attrIdx) { + Object result = null; + switch(attrIdx) { + case 0: /* CURRENCY_NOT_SUPPORTED */ + result = org.webinos.api.payment.PaymentErrors.CURRENCY_NOT_SUPPORTED; + break; + case 1: /* INVALID_OPTION */ + result = org.webinos.api.payment.PaymentErrors.INVALID_OPTION; + break; + case 2: /* PAYMENT_AUTHENTICATION_FAILED */ + result = org.webinos.api.payment.PaymentErrors.PAYMENT_AUTHENTICATION_FAILED; + break; + case 3: /* PAYMENT_CHARGEABLE_EXCEEDED */ + result = org.webinos.api.payment.PaymentErrors.PAYMENT_CHARGEABLE_EXCEEDED; + break; + case 4: /* PAYMENT_CHARGE_FAILED */ + result = org.webinos.api.payment.PaymentErrors.PAYMENT_CHARGE_FAILED; + break; + case 5: /* UNKNOWN_SHOP */ + result = org.webinos.api.payment.PaymentErrors.UNKNOWN_SHOP; + break; + default: + } + return result; + } + + static void __set(org.webinos.api.payment.PaymentErrors inst, int attrIdx, Object val) { + switch(attrIdx) { + default: + throw new UnsupportedOperationException(); + } + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentManager.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentManager.java new file mode 100644 index 00000000..d028b795 --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/platform/Org_webinos_api_payment_PaymentManager.java @@ -0,0 +1,24 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.platform; + +public final class Org_webinos_api_payment_PaymentManager { + + private static Object[] __args = new Object[7]; + + public static Object[] __getArgs() { return __args; } + + static Object __invoke(org.webinos.api.payment.PaymentManager inst, int opIdx, Object[] args) { + inst.pay( + (org.webinos.api.payment.PaymentSuccessCB)args[0], + (org.webinos.api.payment.PaymentErrorCB)args[1], + (org.webinos.api.payment.PaymentChallengeCB)args[2], + (org.webinos.api.payment.ShoppingItem[])args[3], + (org.webinos.api.payment.ShoppingItem)args[4], + (String)args[5], + (String)args[6] + ); + return null; + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentChallengeCB.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentChallengeCB.java new file mode 100644 index 00000000..e28f1a7a --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentChallengeCB.java @@ -0,0 +1,21 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.user; + +public final class Org_webinos_api_payment_PaymentChallengeCB extends org.meshpoint.anode.js.JSInterface implements org.webinos.api.payment.PaymentChallengeCB { + + static int classId = org.meshpoint.anode.bridge.Env.getCurrent().getInterfaceManager().getByClass(org.webinos.api.payment.PaymentChallengeCB.class).getId(); + + Org_webinos_api_payment_PaymentChallengeCB(long instHandle) { super(instHandle); } + + public void finalize() { super.release(classId); } + + private static Object[] __args = new Object[2]; + + public void onPaymentChallenge(String arg0, String arg1) { + __args[0] = arg0; + __args[1] = arg1; + __invoke(classId, 0, __args); + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentErrorCB.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentErrorCB.java new file mode 100644 index 00000000..9b84406b --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentErrorCB.java @@ -0,0 +1,20 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.user; + +public final class Org_webinos_api_payment_PaymentErrorCB extends org.meshpoint.anode.js.JSInterface implements org.webinos.api.payment.PaymentErrorCB { + + static int classId = org.meshpoint.anode.bridge.Env.getCurrent().getInterfaceManager().getByClass(org.webinos.api.payment.PaymentErrorCB.class).getId(); + + Org_webinos_api_payment_PaymentErrorCB(long instHandle) { super(instHandle); } + + public void finalize() { super.release(classId); } + + private static Object[] __args = new Object[1]; + + public void onError(org.webinos.api.payment.PaymentError arg0) { + __args[0] = arg0; + __invoke(classId, 0, __args); + } + +} diff --git a/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentSuccessCB.java b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentSuccessCB.java new file mode 100644 index 00000000..88328bb4 --- /dev/null +++ b/webinos/platform/android/api/src/org/meshpoint/anode/stub/gen/user/Org_webinos_api_payment_PaymentSuccessCB.java @@ -0,0 +1,20 @@ +/* This file has been automatically generated; do not edit */ + +package org.meshpoint.anode.stub.gen.user; + +public final class Org_webinos_api_payment_PaymentSuccessCB extends org.meshpoint.anode.js.JSInterface implements org.webinos.api.payment.PaymentSuccessCB { + + static int classId = org.meshpoint.anode.bridge.Env.getCurrent().getInterfaceManager().getByClass(org.webinos.api.payment.PaymentSuccessCB.class).getId(); + + Org_webinos_api_payment_PaymentSuccessCB(long instHandle) { super(instHandle); } + + public void finalize() { super.release(classId); } + + private static Object[] __args = new Object[1]; + + public void onSuccess(String arg0) { + __args[0] = arg0; + __invoke(classId, 0, __args); + } + +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeCB.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeCB.java new file mode 100644 index 00000000..12f6f617 --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeCB.java @@ -0,0 +1,7 @@ +package org.webinos.api.payment; + +import org.meshpoint.anode.idl.Callback; + +public interface PaymentChallengeCB extends Callback { + public void onPaymentChallenge(String type, String challenge); +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeType.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeType.java new file mode 100644 index 00000000..397163b0 --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentChallengeType.java @@ -0,0 +1,7 @@ +package org.webinos.api.payment; + +public class PaymentChallengeType { + public static final String TEXT = "text"; + public static final String IMAGE = "image"; + public static final String URL = "url"; +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentError.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentError.java new file mode 100644 index 00000000..69020fa9 --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentError.java @@ -0,0 +1,28 @@ +/******************************************************************************* +* Code contributed to the webinos project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2011-2012 Toby Ealden +* +******************************************************************************/ + +package org.webinos.api.payment; + +import org.meshpoint.anode.idl.Dictionary; + +public class PaymentError implements Dictionary { + public String code; + public String message; + public boolean permanent; +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrorCB.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrorCB.java new file mode 100644 index 00000000..9ed425fe --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrorCB.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Code contributed to the webinos project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2011-2012 Toby Ealden +* +******************************************************************************/ + +package org.webinos.api.payment; + +public interface PaymentErrorCB { + public void onError(PaymentError error); +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrors.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrors.java new file mode 100644 index 00000000..296a32ed --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentErrors.java @@ -0,0 +1,10 @@ +package org.webinos.api.payment; + +public class PaymentErrors { + public static final String PAYMENT_CHARGE_FAILED = "payment_charge_failed"; + public static final String PAYMENT_CHARGEABLE_EXCEEDED = "payment_chargeable_exceeded"; + public static final String PAYMENT_AUTHENTICATION_FAILED = "payment_authentication_failed"; + public static final String CURRENCY_NOT_SUPPORTED = "currency_not_supported"; + public static final String INVALID_OPTION = "invalid_option"; + public static final String UNKNOWN_SHOP = "unknown_shop"; +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentManager.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentManager.java new file mode 100644 index 00000000..a804eccb --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentManager.java @@ -0,0 +1,30 @@ +/******************************************************************************* +* Code contributed to the webinos project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2011-2012 Toby Ealden +* +******************************************************************************/ + +package org.webinos.api.payment; + +import org.meshpoint.anode.bridge.Env; +import org.meshpoint.anode.java.Base; + +public abstract class PaymentManager extends Base { + private static short classId = Env.getInterfaceId(PaymentManager.class); + protected PaymentManager() { super(classId); } + + public abstract void pay(PaymentSuccessCB successCallback, PaymentErrorCB errorCallback, PaymentChallengeCB challengeCallback, ShoppingItem [] itemList, ShoppingItem bill, String customerID, String sellerID); +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/PaymentSuccessCB.java b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentSuccessCB.java new file mode 100644 index 00000000..7c553d25 --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/PaymentSuccessCB.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Code contributed to the webinos project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2011-2012 Paddy Byers +* +******************************************************************************/ + +package org.webinos.api.payment; + +public interface PaymentSuccessCB { + public void onSuccess (String proofOfPurchase); +} diff --git a/webinos/platform/android/api/src/org/webinos/api/payment/ShoppingItem.java b/webinos/platform/android/api/src/org/webinos/api/payment/ShoppingItem.java new file mode 100644 index 00000000..63fa8e4b --- /dev/null +++ b/webinos/platform/android/api/src/org/webinos/api/payment/ShoppingItem.java @@ -0,0 +1,13 @@ +package org.webinos.api.payment; + +import org.meshpoint.anode.idl.Dictionary; + +public class ShoppingItem implements Dictionary { + public String productID; + public String description; + public String currency; + public float itemPrice; + + public int itemCount; + public float itemsPrice; +} diff --git a/webinos/platform/android/app/ant.properties b/webinos/platform/android/app/ant.properties index 63c6c039..e93edc85 100644 --- a/webinos/platform/android/app/ant.properties +++ b/webinos/platform/android/app/ant.properties @@ -1,4 +1,4 @@ sdk.dir=${env.ANDROID_HOME} -source.dir=src;../api/src;${env.ANODE_ROOT}/bridge-java/src;../impl/src;${env.ANODE_ROOT}/libnode/src;../util/src +source.dir=src;../api/src;${env.ANODE_ROOT}/bridge-java/src;../impl/src;../wallet/WebinosWalletLib/src;${env.ANODE_ROOT}/libnode/src;../util/src diff --git a/webinos/platform/android/app/src/org/webinos/app/pzp/PzpService.java b/webinos/platform/android/app/src/org/webinos/app/pzp/PzpService.java index 31cff760..0d933774 100644 --- a/webinos/platform/android/app/src/org/webinos/app/pzp/PzpService.java +++ b/webinos/platform/android/app/src/org/webinos/app/pzp/PzpService.java @@ -186,7 +186,12 @@ void writeConfig() { } String getCmd() { - return Config.getInstance().getProperty("pzp.cmd"); + try{ + return Config.getInstance().getProperty("pzp.cmd"); + }catch (Exception ex){ + Log.e(TAG, "FAILED TO READ CONFIG CMD",ex); + return "data/data/org.webinos.app/node_modules/webinos/wp4/webinos_pzp.js"; + } } } @@ -198,7 +203,12 @@ private void initConfig() { /* set defaults if not already set */ Config config = Config.getInstance(); if(configParams.autoStart == null) - configParams.autoStart = config.getProperty("pzp.autoStart"); + if (config!=null) + configParams.autoStart = config.getProperty("pzp.autoStart"); + else{ + configParams.autoStart = "false"; + Log.e(TAG, "FAILED TO READ CONFIG autoStart"); + } } /******************* diff --git a/webinos/platform/android/build.xml b/webinos/platform/android/build.xml index cf362dc9..50afd2cb 100644 --- a/webinos/platform/android/build.xml +++ b/webinos/platform/android/build.xml @@ -32,24 +32,50 @@ - + - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webinos/platform/android/impl/src/org/webinos/impl/DeviceorientationImpl.java b/webinos/platform/android/impl/src/org/webinos/impl/DeviceorientationImpl.java index 95a7f137..2feb13ce 100644 --- a/webinos/platform/android/impl/src/org/webinos/impl/DeviceorientationImpl.java +++ b/webinos/platform/android/impl/src/org/webinos/impl/DeviceorientationImpl.java @@ -69,11 +69,11 @@ public synchronized void watchOrientation(OrientationCB orientationCb) { @Override public synchronized void watchMotion(MotionCB motionCb) { (accelerometerListener = new AccelerometerListener(motionCb)).start(); - sensorManager.registerListener(accelerometerListener, accelerometerSensor, SensorManager.SENSOR_DELAY_FASTEST); + sensorManager.registerListener(accelerometerListener, accelerometerSensor, SensorManager.SENSOR_DELAY_GAME); if(linearAccelerometerSensor != null) - sensorManager.registerListener(accelerometerListener, linearAccelerometerSensor, SensorManager.SENSOR_DELAY_FASTEST); + sensorManager.registerListener(accelerometerListener, linearAccelerometerSensor, SensorManager.SENSOR_DELAY_GAME); if(magneticSensor != null) - sensorManager.registerListener(accelerometerListener, magneticSensor, SensorManager.SENSOR_DELAY_FASTEST); + sensorManager.registerListener(accelerometerListener, magneticSensor, SensorManager.SENSOR_DELAY_GAME); } @Override diff --git a/webinos/platform/android/impl/src/org/webinos/impl/GeolocationImpl.java b/webinos/platform/android/impl/src/org/webinos/impl/GeolocationImpl.java index 33936a09..bc6d4e5c 100644 --- a/webinos/platform/android/impl/src/org/webinos/impl/GeolocationImpl.java +++ b/webinos/platform/android/impl/src/org/webinos/impl/GeolocationImpl.java @@ -59,7 +59,6 @@ public class GeolocationImpl extends GeolocationManager implements IModule, Loca private Set pendingRequests; private HashMap watches; private long nextWatchId = 1; - private int watchCount; private int highAccuracyCount; private LocationManager locationManager; @@ -67,7 +66,7 @@ public class GeolocationImpl extends GeolocationManager implements IModule, Loca private Criteria highAccuracyCriteria; private String currentWatchProvider; - private static final float minDistanceChange = 1; + private static final float minDistanceChange = 0; private static final long minTimeChange = 100; private static final String TAG = "org.webinos.impl.GeolocationImpl"; @@ -133,7 +132,11 @@ public long watchPosition(PositionCallback successCallback, @Override public void clearWatch(long id) { Log.v(TAG, "clearWatch(): ent id = " + id); - getWatch(id).deschedule(); + Watch watch = getWatch(id); + if(watch != null) { + watch.deschedule(); + removeWatch(watch); + } } /***************************** @@ -198,7 +201,7 @@ public void stopModule() { private synchronized void resetProvider() { Log.v(TAG, "resetProvider(): ent"); - if(watchCount == 0) { + if(watches.size() == 0) { locationManager.removeUpdates(this); currentWatchProvider = null; Log.v(TAG, "resetProvider(): ret (no watches)"); @@ -285,6 +288,7 @@ protected synchronized void dispatch(PositionError error) { errorCallback.handleEvent(error); } inError = true; + deschedule(); } protected void schedule() { @@ -309,7 +313,10 @@ protected boolean tryLastKnownPosition(String provider) { Location location = locationManager.getLastKnownLocation(provider); if(location != null) { - if((location.getTime() - System.currentTimeMillis()) < maximumAge) { + long posTime = location.getTime(); + long currTime = System.currentTimeMillis(); + long age = currTime - posTime; + if(age < maximumAge) { dispatch(toPosition(location)); return true; } @@ -319,7 +326,9 @@ protected boolean tryLastKnownPosition(String provider) { @Override public void onLocationChanged(Location location) { - if((location.getTime() - System.currentTimeMillis()) < maximumAge) { + /* only call the callback if we haven't already + * called the error callback */ + if(!inError) { dispatch(toPosition(location)); deschedule(); } @@ -371,7 +380,14 @@ private Watch(PositionCallback successCallback, PositionErrorCallback errorCallb synchronized(GeolocationImpl.this) { addWatch(this); if(!tryLastKnownPosition(currentWatchProvider)) { + /* last known position didn't match the criteria; + * but we can't just rely on getLocationUpdates() because + * those updates are unlikely to fire, since the position + * won't be that much different from a (stale) last known + * position. So here we request a single update to get + * the first result */ schedule(); + locationManager.requestSingleUpdate(currentWatchProvider, this, androidContext.getMainLooper()); } } } @@ -386,13 +402,12 @@ protected synchronized void dispatch(Position position) { protected void deschedule() { stopTimer(); - removeWatch(this); } } private synchronized void addWatch(Watch watch) { watches.put(watch.key, watch); - boolean statusChange = (watchCount++ == 0); + boolean statusChange = (watches.size() == 1); if(watch.enableHighAccuracy) { statusChange |= (highAccuracyCount++ == 0); } @@ -401,7 +416,7 @@ private synchronized void addWatch(Watch watch) { private synchronized void removeWatch(Watch watch) { watches.remove(watch.key); - boolean statusChange = (--watchCount == 0); + boolean statusChange = (watches.size() == 0); if(watch.enableHighAccuracy) { statusChange |= (--highAccuracyCount == 0); } diff --git a/webinos/platform/android/impl/src/org/webinos/impl/PaymentImpl.java b/webinos/platform/android/impl/src/org/webinos/impl/PaymentImpl.java new file mode 100644 index 00000000..8d23d2f8 --- /dev/null +++ b/webinos/platform/android/impl/src/org/webinos/impl/PaymentImpl.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Code contributed to the webinos project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2011-2013 Paddy Byers + * + ******************************************************************************/ + +package org.webinos.impl; + +import org.meshpoint.anode.AndroidContext; +import org.meshpoint.anode.bridge.Env; +import org.meshpoint.anode.module.IModule; +import org.meshpoint.anode.module.IModuleContext; +import org.webinos.api.payment.PaymentChallengeCB; +import org.webinos.api.payment.PaymentErrorCB; +import org.webinos.api.payment.PaymentManager; +import org.webinos.api.payment.PaymentSuccessCB; +import org.webinos.api.payment.ShoppingItem; +import android.util.Log; + +import android.content.Context; + +public class PaymentImpl extends PaymentManager implements IModule { + static final String TAG = PaymentImpl.class.getCanonicalName(); + + private Context androidContext; + static Env env = Env.getCurrent(); + + /***************************** + * PaymentManager methods + *****************************/ + + @Override + public void pay(final PaymentSuccessCB successCallback, + final PaymentErrorCB errorCallback, final PaymentChallengeCB challengeCallback, + final ShoppingItem[] itemList, final ShoppingItem bill, final String customerID, + final String sellerID) { + + Log.d(TAG, "Received bill with price " + bill.itemsPrice + " and desc " + bill.description); + PaymentTransaction transaction = new PaymentTransaction(androidContext, customerID, sellerID, successCallback, errorCallback); + transaction.perform(itemList, bill); + } + + /***************************** + * IModule methods + *****************************/ + @Override + public Object startModule(IModuleContext ctx) { + androidContext = ((AndroidContext)ctx).getAndroidContext(); + /* + * perform module initialisation here ... + */ + return this; + } + + @Override + public void stopModule() { + /* + * perform any module shutdown here ... + */ + } + +} \ No newline at end of file diff --git a/webinos/platform/android/impl/src/org/webinos/impl/PaymentTransaction.java b/webinos/platform/android/impl/src/org/webinos/impl/PaymentTransaction.java new file mode 100644 index 00000000..41b1ffdd --- /dev/null +++ b/webinos/platform/android/impl/src/org/webinos/impl/PaymentTransaction.java @@ -0,0 +1,194 @@ +package org.webinos.impl; + +import java.util.LinkedList; +import java.util.Queue; + +import org.meshpoint.anode.bridge.Env; +import org.webinos.api.payment.PaymentError; +import org.webinos.api.payment.PaymentErrorCB; +import org.webinos.api.payment.PaymentErrors; +import org.webinos.api.payment.PaymentSuccessCB; +import org.webinos.api.payment.ShoppingItem; + +import android.content.Context; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.util.Log; + +import org.webinos.payment.Store; +import org.webinos.payment.BillableItem; +import org.webinos.payment.WalletEngine; + + +public class PaymentTransaction { + private final static String TAG = PaymentTransaction.class.getName(); + private Context context; + private Env env; + private WalletEngine walletEngine; + @SuppressWarnings("unused") + private String customerID; + private String sellerID; + final private PaymentSuccessCB successCallback; + final private PaymentErrorCB errorCallback; + private Looper answerLooper; + private Handler answerHandler; + private Handler.Callback answerCallback; + private boolean exit; + + private Queue callQueue = new LinkedList(); + + private abstract class AsyncCall implements Runnable { + private void call() { answerHandler.postDelayed(this, 400L); } + } + + private class OpenShop extends AsyncCall { + @Override + public void run() { + walletEngine = new WalletEngine(context, answerCallback); + /* we need to wait for a short time to allow the + * library to connect to the webinos wallet service; there is + * no synchronisation for this */ + try { Thread.sleep(500L); } catch(InterruptedException ie) {} + Store store = new Store(sellerID, "Webinos Application"); + walletEngine.openShop(store); + } + } + + private class AddItems extends AsyncCall { + private ShoppingItem bill; + AddItems(ShoppingItem bill) { this.bill = bill; } + @Override + public void run() { + String productID = bill.productID; + String productName = bill.productID; /* FIXME: do we need an explicit product name */ + String productDescription = bill.description; + String currency = bill.currency; + /* FIXME: change this multiplier based on currency? */ + long price = (long)(bill.itemsPrice * 100); + Log.d(TAG, "Received item " + productDescription + " with price " + bill.itemsPrice + " and sending " + price + " to the payment"); + BillableItem billItem = new BillableItem(productID, productName, productDescription, currency, price, 1); + walletEngine.addItem(billItem); + } + } + + private class Checkout extends AsyncCall { + @Override + public void run() { + walletEngine.checkout(); + } + } + + private PaymentError handleAnswer(Message msg) { + /* if we've been told to exit, then this answer + * is the answer we were waiting for .. so exit on return */ + if(exit) + answerLooper.quit(); + + if(msg.what == WalletEngine.RESPONSE_CODE_OK || msg.what == WalletEngine.RESPONSE_CODE_CHECKOUT_OK) { + return null; + } + + PaymentError error = new PaymentError(); + error.message = "The payment failed"; + switch(msg.what) { + case WalletEngine.RESPONSE_CODE_CHECKOUT_FAIL: + //error.code = PaymentErrors.PAYMENT_AUTHENTICATION_FAILED; + //error.code = PaymentErrors.PAYMENT_CHARGEABLE_EXCEEDED; + error.code = PaymentErrors.PAYMENT_CHARGE_FAILED; + break; + case WalletEngine.RESPONSE_CODE_UNKNOWN: + error.code = PaymentErrors.INVALID_OPTION; + break; + case WalletEngine.RESPONSE_CODE_FAIL: + error.code = PaymentErrors.INVALID_OPTION; + break; + } + return error; + } + + PaymentTransaction(Context ctx, String customerID, String sellerID, PaymentSuccessCB successCallback, + PaymentErrorCB errorCallback) { + this.context = ctx; + this.env = Env.getCurrent(); + this.customerID = customerID; + this.sellerID = sellerID; + this.successCallback = successCallback; + this.errorCallback = errorCallback; + } + + void perform(final ShoppingItem[] itemList, final ShoppingItem bill) { + callQueue.add(new OpenShop()); + callQueue.add(new AddItems(bill)); + callQueue.add(new Checkout()); + + /* Callbacks for async indications from the shop engine */ + answerCallback = new Handler.Callback() { + @Override + public boolean handleMessage(Message msg) { + /* get the answer for the current operation */ + PaymentError error = handleAnswer(msg); + if(error != null) { + /* if there was an error, end here */ + errorCallback.onError(error); + finish(); + return true; + } + /* if there's no next call, we're done */ + if(callQueue.isEmpty()) { + if(finish()) { + String proofOfPurchase = "Reciept received"; /* we don't get one from the engine */ + successCallback.onSuccess(proofOfPurchase); + } + return true; + } + + /* if there's a next item, call it */ + callQueue.remove().call(); + return true; + } + }; + + /* this thread is the handler that handles answer messages + * from the shop engine; therefore we have to open the shop + * in this thread */ + synchronized(this) { + (new Thread() { + @Override + public void run() { + Env.setEnv(env); + Looper.prepare(); + answerHandler = new Handler(); + synchronized(PaymentTransaction.this) {PaymentTransaction.this.notify();} + answerLooper = Looper.myLooper(); + Looper.loop(); + } + }).start(); + try { + wait(); + } catch(InterruptedException ie) {} + } + + /* call the first item in the queue */ + callQueue.remove().call(); + } + + private boolean finish() { + /* ensure we don't reenter this */ + if(exit) + return false; + + if(walletEngine != null) { + /* we need to release the engine, and don't + * exit the looper until we've had the answer to that */ + exit = true; + walletEngine.release(); + walletEngine = null; + return true; + } + /* otherwise there's nothing to do, so we can + * quit immediately */ + answerLooper.quit(); + return true; + } +} \ No newline at end of file diff --git a/webinos/platform/android/wallet/Images/Wallet-256.png b/webinos/platform/android/wallet/Images/Wallet-256.png new file mode 100644 index 00000000..8fb62c9d Binary files /dev/null and b/webinos/platform/android/wallet/Images/Wallet-256.png differ diff --git a/webinos/platform/android/wallet/Images/walletBG.psd b/webinos/platform/android/wallet/Images/walletBG.psd new file mode 100644 index 00000000..1996e7c6 Binary files /dev/null and b/webinos/platform/android/wallet/Images/walletBG.psd differ diff --git a/webinos/platform/android/wallet/WebinosWallet/AndroidManifest.xml b/webinos/platform/android/wallet/WebinosWallet/AndroidManifest.xml new file mode 100644 index 00000000..7d53631a --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/webinos/platform/android/wallet/WebinosWallet/ant.properties b/webinos/platform/android/wallet/WebinosWallet/ant.properties new file mode 100644 index 00000000..b0971e89 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/webinos/platform/android/wallet/WebinosWallet/build.xml b/webinos/platform/android/wallet/WebinosWallet/build.xml new file mode 100644 index 00000000..f3ffd240 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/BuildConfig.java b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/BuildConfig.java new file mode 100644 index 00000000..834f9f2f --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/BuildConfig.java @@ -0,0 +1,8 @@ +/*___Generated_by_IDEA___*/ + +/** Automatically generated file. DO NOT MODIFY */ +package org.webinos.payment; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/Manifest.java b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/Manifest.java new file mode 100644 index 00000000..2aa49348 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/Manifest.java @@ -0,0 +1,7 @@ +/*___Generated_by_IDEA___*/ + +package org.webinos.payment; + +/* This stub is for using by IDE only. It is NOT the Manifest class actually packed into APK */ +public final class Manifest { +} \ No newline at end of file diff --git a/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/R.java b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/R.java new file mode 100644 index 00000000..f6def71f --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/gen/org/webinos/payment/R.java @@ -0,0 +1,7 @@ +/*___Generated_by_IDEA___*/ + +package org.webinos.payment; + +/* This stub is for using by IDE only. It is NOT the R class actually packed into APK */ +public final class R { +} \ No newline at end of file diff --git a/webinos/platform/android/wallet/WebinosWallet/local.properties b/webinos/platform/android/wallet/WebinosWallet/local.properties new file mode 100644 index 00000000..d1f83f44 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=C:\\Documents and Settings\\Abot\\Local Settings\\Application Data\\Android\\android-sdk diff --git a/webinos/platform/android/wallet/WebinosWallet/proguard-project.txt b/webinos/platform/android/wallet/WebinosWallet/proguard-project.txt new file mode 100644 index 00000000..f2fe1559 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/webinos/platform/android/wallet/WebinosWallet/project.properties b/webinos/platform/android/wallet/WebinosWallet/project.properties new file mode 100644 index 00000000..a3ee5ab6 --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/background.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/background.png new file mode 100644 index 00000000..b7425724 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/background.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button.png new file mode 100644 index 00000000..a9078214 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button2.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button2.png new file mode 100644 index 00000000..f39f87f2 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/button2.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/ic_launcher.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 00000000..efb715b0 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-hdpi/ic_launcher.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-ldpi/ic_launcher.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 00000000..5f9aaa41 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-ldpi/ic_launcher.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-mdpi/ic_launcher.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 00000000..546587f7 Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-mdpi/ic_launcher.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/drawable-xhdpi/ic_launcher.png b/webinos/platform/android/wallet/WebinosWallet/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 00000000..df6a1cad Binary files /dev/null and b/webinos/platform/android/wallet/WebinosWallet/res/drawable-xhdpi/ic_launcher.png differ diff --git a/webinos/platform/android/wallet/WebinosWallet/res/layout/main.xml b/webinos/platform/android/wallet/WebinosWallet/res/layout/main.xml new file mode 100644 index 00000000..7e0f67ac --- /dev/null +++ b/webinos/platform/android/wallet/WebinosWallet/res/layout/main.xml @@ -0,0 +1,67 @@ + + + + + + + + + - - - -

-

- 1. Press "Find DeviceOrientation Service" Button - to get the Service
2. Press "Bind" button to bind the found service.
3. Register for Events
4. You may try another browser if the logo does not transforms

-
- -
-
    -
-
-
-
    -
-
- + +
+ +
+
+
+
+ +
+
+

+ +

DeviceOrientation Services: Click find to fill this
+ + + +
+ + +
+ + +

+

+ +

+ 1. Press "Find DeviceOrientation Service" Button + to get the Service
2. Press "Bind" button to bind the found service.
3. Register for Events
4. You + may try another browser if the logo does not transforms
+
+
+
+
+
    +
+
+
+
    +
+
+ diff --git a/webinos/web_root/testbed/payment2/payment2.html b/webinos/web_root/testbed/payment2/payment2.html new file mode 100644 index 00000000..48ca3897 --- /dev/null +++ b/webinos/web_root/testbed/payment2/payment2.html @@ -0,0 +1,163 @@ + + + webinos rpc + + + + + + + +

+

PZH PZP LIST :
+
+
+ +

+ +
+
+ + + + + diff --git a/webinos_config.Laptop.json b/webinos_config.Laptop.json new file mode 100644 index 00000000..d9ae8372 --- /dev/null +++ b/webinos_config.Laptop.json @@ -0,0 +1,136 @@ +{ + "ports": { + "provider": 80, + "provider_webServer": 443, + "pzp_webSocket": 8080, + "pzp_tlsServer": 8040, + "pzp_zeroConf": 4321, + "iot": 3000 + }, + "pzhDefaultServices": [ + { + "name": "test", + "params": {} + }, + { + "name": "app2app", + "params": { + "scope": "pzh" + } + }, + { + "name": "events", + "params": {} + }, + { + "name": "zonenotification", + "params": {} + } + ], + "pzpDefaultServices": [ + { + "name": "test", + "params": { + "num": "21" + } + }, + { + "name": "app2app", + "params": { + "scope": "pzp" + } + }, + { + "name": "webnotification", + "params": {} + }, + { + "name": "file", + "params": { + "local": { + "server": { + "port": 9999, + "hostname": "192.168.99.200" + }, + "shares": [ + { + "name": "PC-SHARE", + "path": "C:\\webinos\\SharedMedia" + } + ] + } + } + }, + { + "name": "geolocation", + "params": { + "connector": "simulator" + } + }, + { + "name": "deviceorientation", + "params": { + "connector": "simulator" + } + }, + { + "name": "vehicle", + "params": { + "connector": "simulator" + } + }, + { + "name": "applauncher", + "params": {} + }, + { + "name": "tv", + "params": {} + }, + { + "name": "oauth", + "params": {} + }, + { + "name": "authentication", + "params": {} + }, + { + "name": "contacts", + "params": {} + }, + { + "name": "devicestatus", + "params": { + "devicetype": "laptop" + } + }, + { + "name": "discovery", + "params": {} + }, + { + "name": "mediacontent", + "params": {} + }, + { + "name": "corePZinformation", + "params": {} + } + ], + "certConfiguration": { + "country": "UK", + "state": "MX", + "city": "London", + "orgname": "Webinos", + "orgunit": "WP4", + "cn": "", + "email": "hello@webinos.org" + }, + "friendlyName": "", + "webinos_version": { + "tag": "v0.8.0", + "num_commit": "15", + "commit_id": "gba7314e" + } +} \ No newline at end of file diff --git a/webinos_config.TV.json b/webinos_config.TV.json new file mode 100644 index 00000000..2de5554b --- /dev/null +++ b/webinos_config.TV.json @@ -0,0 +1,109 @@ +{ + "ports": { + "provider": 80, + "provider_webServer": 443, + "pzp_webSocket": 8080, + "pzp_tlsServer": 8040, + "pzp_zeroConf": 4321, + "iot": 3000 + }, + "pzhDefaultServices": [ + { + "name": "test", + "params": {} + }, + { + "name": "app2app", + "params": { + "scope": "pzh" + } + }, + { + "name": "events", + "params": {} + }, + { + "name": "zonenotification", + "params": {} + } + ], + "pzpDefaultServices": [ + { + "name": "test", + "params": { + "num": "21" + } + }, + { + "name": "actuator", + "params": {} + }, + { + "name": "app2app", + "params": { + "scope": "pzp" + } + }, + { + "name": "webnotification", + "params": {} + }, + { + "name": "file", + "params": {} + }, + { + "name": "applauncher", + "params": {} + }, + { + "name": "tv", + "params": {} + }, + { + "name": "oauth", + "params": {} + }, + { + "name": "authentication", + "params": {} + }, + { + "name": "contacts", + "params": {} + }, + { + "name": "devicestatus", + "params": { + "devicetype": "laptop" + } + }, + { + "name": "mediacontent", + "params": {} + }, + { + "name": "corePZinformation", + "params": {} + }, + { + "name": "nfc", + "params": {} + } + ], + "certConfiguration": { + "country": "UK", + "state": "MX", + "city": "London", + "orgname": "Webinos", + "orgunit": "WP4", + "cn": "", + "email": "hello@webinos.org" + }, + "friendlyName": "", + "webinos_version": { + "tag": "v0.8.0", + "num_commit": "15", + "commit_id": "gba7314e" + } +} \ No newline at end of file diff --git a/webinos_config.WALLET.json b/webinos_config.WALLET.json new file mode 100644 index 00000000..2e28f484 --- /dev/null +++ b/webinos_config.WALLET.json @@ -0,0 +1,113 @@ +{ + "ports": { + "provider": 80, + "provider_webServer": 443, + "pzp_webSocket": 8080, + "pzp_tlsServer": 8040, + "pzp_zeroConf": 4321, + "iot": 3000 + }, + "pzhDefaultServices": [ + { + "name": "test", + "params": {} + }, + { + "name": "app2app", + "params": { + "scope": "pzh" + } + }, + { + "name": "events", + "params": {} + }, + { + "name": "zonenotification", + "params": {} + } + ], + "pzpDefaultServices": [ + { + "name": "test", + "params": { + "num": "21" + } + }, + { + "name": "actuator", + "params": {} + }, + { + "name": "app2app", + "params": { + "scope": "pzp" + } + }, + { + "name": "webnotification", + "params": {} + }, + { + "name": "file", + "params": {} + }, + { + "name": "applauncher", + "params": {} + }, + { + "name": "payment", + "params": {} + }, + { + "name": "payment2", + "params": {} + }, + { + "name": "tv", + "params": {} + }, + { + "name": "oauth", + "params": {} + }, + { + "name": "authentication", + "params": {} + }, + { + "name": "contacts", + "params": {} + }, + { + "name": "devicestatus", + "params": { + "devicetype": "laptop" + } + }, + { + "name": "corePZinformation", + "params": {} + }, + { + "name": "nfc", + "params": {} + } + ], + "certConfiguration": { + "country": "UK", + "state": "MX", + "city": "London", + "orgname": "Webinos", + "orgunit": "WP4", + "cn": "", + "email": "hello@webinos.org" + }, + "friendlyName": "", + "webinos_version": { + "tag": "v0.8.0", + "num_commit": "15", + "commit_id": "gba7314e" + } +} \ No newline at end of file diff --git a/webinos_config.json b/webinos_config.json index 462662c4..c6a44828 100644 --- a/webinos_config.json +++ b/webinos_config.json @@ -70,6 +70,10 @@ "name": "payment", "params": {} }, + { + "name": "payment2", + "params": {} + }, { "name": "tv", "params": {}