Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.

Chaincode Update #3

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d077361
Update README.md
Apr 24, 2018
b96ca17
Update README.md
Apr 24, 2018
f8b4dc6
Update README.md
Apr 24, 2018
58986b7
Update README.md
Apr 24, 2018
22a2400
Update README.md
Apr 24, 2018
40106e9
Update README.md
Apr 25, 2018
2fa7a21
Update README.md
Apr 25, 2018
f3cf151
IoT Asset Tracker Network BNA updates
johnwalicki Apr 25, 2018
2554b79
Update README.md
Apr 25, 2018
e645f33
Merge branch 'master' of https://github.com/johnwalicki/IoT-AssetTrac…
Apr 25, 2018
c542dad
Update logic.js
Apr 25, 2018
e2d5741
Update README.md
Apr 26, 2018
15a1fd1
Blockchain README updates
johnwalicki Apr 26, 2018
c866af5
Update perishable.cto
Apr 26, 2018
f9ec2a6
Update README.md
Apr 26, 2018
231781e
Merge branch 'master' of https://github.com/johnwalicki/IoT-AssetTrac…
Apr 26, 2018
4de4d73
Update README.md
Apr 26, 2018
32b6c96
Update README.md
Apr 26, 2018
78e510a
Update perishable.cto
Apr 26, 2018
552c70c
Update README.md
Apr 26, 2018
fea461c
Update README.md
Apr 26, 2018
11a4177
Update README.md
Apr 26, 2018
fd1ee29
Blockchain README updates
johnwalicki Apr 26, 2018
124106d
Fix Blockchain README relative path to logic.js
johnwalicki Apr 26, 2018
fa8488a
Update logic.js
Apr 26, 2018
049d5c5
New BNA file with updated logic.js
johnwalicki Apr 26, 2018
5957a82
Update README.md
Apr 26, 2018
4664db3
Merge branch 'master' of https://github.com/johnwalicki/IoT-AssetTrac…
Apr 26, 2018
50ed2de
Update README.md
Apr 26, 2018
d26c0f5
Update README.md
Apr 26, 2018
b44be86
Update README.md
Apr 26, 2018
7979d7f
Update README.md
Jul 3, 2018
845bc2c
Resync IoT Perishable Model
johnwalicki Jul 15, 2018
dd78244
Update README.md
Sep 20, 2018
d00eb4e
Update README.md
Sep 20, 2018
4c728b1
IoT Asset Tracker Route Simulator
johnwalicki Oct 11, 2018
6c433d6
Simulated Route Instructions
johnwalicki Oct 12, 2018
ad7005b
Simulated Route Instructions
johnwalicki Oct 12, 2018
9264e61
Simulated Route Instructions
johnwalicki Oct 12, 2018
0a65ce2
Simulated Route Instructions
johnwalicki Oct 12, 2018
a8b18bd
Update README.md
johnwalicki Nov 29, 2018
c0b966a
Update README.md
johnwalicki Dec 4, 2018
3ef51e9
Update README.md
Grant-Steinfeld Aug 29, 2019
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
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
Binary file added Blockchain/.DS_Store
Binary file not shown.
19 changes: 10 additions & 9 deletions Blockchain/IoT-Perishable-Network/lib/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* limitations under the License.
*/

'use strict';
/**
* A shipment has been received by an importer
* @param {org.acme.shipping.perishable.ShipmentReceived} shipmentReceived - the ShipmentReceived transaction
Expand Down Expand Up @@ -160,7 +161,7 @@ function AccelReading(AccelReading) {
AccelerationEvent.accel_x = AccelReading.accel_x;
AccelerationEvent.accel_y = AccelReading.accel_y;
AccelerationEvent.accel_z = AccelReading.accel_z;
AccelerationEvent.latitude = AccelReading.latitude;
AccelerationEvent.latitude = AccelReading.latitude;
AccelerationEvent.longitude = AccelReading.longitude;
AccelerationEvent.readingTime = AccelReading.readingTime;
AccelerationEvent.message = 'Acceleration threshold violated! Emitting AccelerationEvent for shipment: ' + shipment.$identifier;
Expand All @@ -171,7 +172,7 @@ function AccelReading(AccelReading) {
.then(function (shipmentRegistry) {
// add the temp reading to the shipment
return shipmentRegistry.update(shipment);
});
});
}

/**
Expand All @@ -182,10 +183,10 @@ function AccelReading(AccelReading) {
function gpsReading(gpsReading) {

var factory = getFactory();
var NS = "org.acme.shipping.perishable";
var NS = 'org.acme.shipping.perishable';
var shipment = gpsReading.shipment;
var PORT_OF_NEW_YORK = '/LAT:40.6840N/LONG:74.0062W';

if (shipment.gpsReadings) {
shipment.gpsReadings.push(gpsReading);
} else {
Expand All @@ -195,7 +196,7 @@ function gpsReading(gpsReading) {
var latLong = '/LAT:' + gpsReading.latitude + gpsReading.latitudeDir + '/LONG:' +
gpsReading.longitude + gpsReading.longitudeDir;

if (latLong == PORT_OF_NEW_YORK) {
if (latLong === PORT_OF_NEW_YORK) {
var shipmentInPortEvent = factory.newEvent(NS, 'ShipmentInPortEvent');
shipmentInPortEvent.shipment = shipment;
var message = 'Shipment has reached the destination port of ' + PORT_OF_NEW_YORK;
Expand All @@ -204,10 +205,10 @@ function gpsReading(gpsReading) {
}

return getAssetRegistry(NS + '.Shipment')
.then(function (shipmentRegistry) {
.then(function (shipmentRegistry) {
// add the temp reading to the shipment
return shipmentRegistry.update(shipment);
});
return shipmentRegistry.update(shipment);
});
}

/**
Expand Down Expand Up @@ -295,4 +296,4 @@ function setupDemo(setupDemo) {
// add the shipments
return shipmentRegistry.addAll([shipment]);
});
}
}
19 changes: 10 additions & 9 deletions Blockchain/IoT-Perishable-Network/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* limitations under the License.
*/

'use strict';
/**
* A shipment has been received by an importer
* @param {org.acme.shipping.perishable.ShipmentReceived} shipmentReceived - the ShipmentReceived transaction
Expand Down Expand Up @@ -160,7 +161,7 @@ function AccelReading(AccelReading) {
AccelerationEvent.accel_x = AccelReading.accel_x;
AccelerationEvent.accel_y = AccelReading.accel_y;
AccelerationEvent.accel_z = AccelReading.accel_z;
AccelerationEvent.latitude = AccelReading.latitude;
AccelerationEvent.latitude = AccelReading.latitude;
AccelerationEvent.longitude = AccelReading.longitude;
AccelerationEvent.readingTime = AccelReading.readingTime;
AccelerationEvent.message = 'Acceleration threshold violated! Emitting AccelerationEvent for shipment: ' + shipment.$identifier;
Expand All @@ -171,7 +172,7 @@ function AccelReading(AccelReading) {
.then(function (shipmentRegistry) {
// add the temp reading to the shipment
return shipmentRegistry.update(shipment);
});
});
}

/**
Expand All @@ -182,10 +183,10 @@ function AccelReading(AccelReading) {
function gpsReading(gpsReading) {

var factory = getFactory();
var NS = "org.acme.shipping.perishable";
var NS = 'org.acme.shipping.perishable';
var shipment = gpsReading.shipment;
var PORT_OF_NEW_YORK = '/LAT:40.6840N/LONG:74.0062W';

if (shipment.gpsReadings) {
shipment.gpsReadings.push(gpsReading);
} else {
Expand All @@ -195,7 +196,7 @@ function gpsReading(gpsReading) {
var latLong = '/LAT:' + gpsReading.latitude + gpsReading.latitudeDir + '/LONG:' +
gpsReading.longitude + gpsReading.longitudeDir;

if (latLong == PORT_OF_NEW_YORK) {
if (latLong === PORT_OF_NEW_YORK) {
var shipmentInPortEvent = factory.newEvent(NS, 'ShipmentInPortEvent');
shipmentInPortEvent.shipment = shipment;
var message = 'Shipment has reached the destination port of ' + PORT_OF_NEW_YORK;
Expand All @@ -204,10 +205,10 @@ function gpsReading(gpsReading) {
}

return getAssetRegistry(NS + '.Shipment')
.then(function (shipmentRegistry) {
.then(function (shipmentRegistry) {
// add the temp reading to the shipment
return shipmentRegistry.update(shipment);
});
return shipmentRegistry.update(shipment);
});
}

/**
Expand Down Expand Up @@ -295,4 +296,4 @@ function setupDemo(setupDemo) {
// add the shipments
return shipmentRegistry.addAll([shipment]);
});
}
}
29 changes: 15 additions & 14 deletions Blockchain/IoT-Perishable-Network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"description": "IoT Asset Tracker Perishable Goods Business Network",
"scripts": {
"clean": "rm -Rf ./node_modules ./dist ./composer-logs ./out",
"prepublish": "mkdirp ./dist && composer archive create --sourceType dir --sourceName . -a ./dist/iot-perishable-network.bna",
"prepublish": "mkdirp ./dist && composer archive create --sourceType dir --sourceName . -a ./dist/iot-asset-tracker-network.bna",
"pretest": "npm run lint",
"lint": "eslint .",
"postlint": "npm run licchk",
Expand All @@ -25,8 +25,8 @@
"shipping",
"goods",
"perishable",
"asset-tracking"
"asset-tracker"
"asset-tracking",
"asset-tracker",
"composer",
"composer-network",
"iot"
Expand All @@ -35,22 +35,23 @@
"license": "Apache-2.0",
"devDependencies": {
"browserfs": "^1.2.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"composer-admin": "^0.14.0-0",
"composer-cli": "^0.14.0-0",
"composer-client": "^0.14.0-0",
"composer-connector-embedded": "^0.14.0-0",
"composer-cucumber-steps": "^0.14.0-0",
"chai": "latest",
"chai-as-promised": "latest",
"composer-admin": "^0.19.1",
"composer-cli": "^0.19.1",
"composer-client": "^0.19.1",
"composer-common": "^0.19.1",
"composer-connector-embedded": "^0.19.1",
"composer-cucumber-steps": "^0.19.1",
"cucumber": "^2.2.0",
"eslint": "^3.6.1",
"eslint": "latest",
"istanbul": "^0.4.5",
"jsdoc": "^3.5.5",
"license-check": "^1.1.5",
"mkdirp": "^0.5.1",
"mocha": "^3.2.0",
"mkdirp": "latest",
"mocha": "latest",
"moment": "^2.17.1",
"nyc": "^11.0.2"
"nyc": "latest"
},
"license-check-config": {
"src": [
Expand Down
Loading