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

Commit

Permalink
Use IBM Blockchain Starter Plan (#2)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* IoT Asset Tracker Network BNA updates

* Update README.md

* Update logic.js

* Update README.md

* Blockchain README updates

* Update perishable.cto

* Update README.md

* Update README.md

* Update README.md

* Update perishable.cto

* Update README.md

* Update README.md

* Update README.md

* Blockchain README updates

* Fix Blockchain README relative path to logic.js
  • Loading branch information
johnwalicki authored and ljbennett62 committed Apr 26, 2018
1 parent 68e9a38 commit c189b54
Show file tree
Hide file tree
Showing 55 changed files with 329 additions and 118 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added Blockchain/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions Blockchain/IoT-Perishable-Network/lib/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function AccelReading(AccelReading) {
.then(function (shipmentRegistry) {
// add the temp reading to the shipment
return shipmentRegistry.update(shipment);
});
});
}

/**
Expand All @@ -185,7 +185,7 @@ function gpsReading(gpsReading) {
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 Down Expand Up @@ -295,4 +295,4 @@ function setupDemo(setupDemo) {
// add the shipments
return shipmentRegistry.addAll([shipment]);
});
}
}
57 changes: 13 additions & 44 deletions Blockchain/IoT-Perishable-Network/models/perishable.cto
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ enum ShipmentStatus {
* Directions of the compass
*/
enum CompassDirection {
o N
o S
o E
o W

}

/**
Expand All @@ -48,48 +45,35 @@ abstract transaction ShipmentTransaction {
/**
* An Accelerometer reading for a shipment. E.g. received from a
* device within an accelerometer controlled shipping container
*
*
* The combination of the accelerometer environment reading,
* PLUS the GPS location, PLUS the timestamp is what is interesting
* Just knowing temperature without knowing where or when is
* not sufficient.
*/
transaction AccelReading extends ShipmentTransaction {
o Double accel_x
o Double accel_y
o Double accel_z
o String latitude
o String longitude
o String readingTime

}

/**
* An temperature reading for a shipment. E.g. received from a
* device within a temperature controlled shipping container
*
*
* The combination of the temperature environment reading,
* PLUS the GPS location, PLUS the timestamp is what is interesting
* Just knowing temperature without knowing where or when is
* not sufficient.
*/
transaction TemperatureReading extends ShipmentTransaction {
o Double celsius
o String latitude
o String longitude
o String readingTime

}

/**
* A GPS reading for a shipment. E.g. received from a device
* within a shipping container
*/
transaction GpsReading extends ShipmentTransaction {
o String readingTime
o String readingDate
o String latitude
o CompassDirection latitudeDir
o String longitude
o CompassDirection longitudeDir

}

/**
Expand All @@ -98,6 +82,7 @@ transaction GpsReading extends ShipmentTransaction {
* to the grower to pay for the shipment.
*/
transaction ShipmentReceived extends ShipmentTransaction {

}

/**
Expand All @@ -109,9 +94,7 @@ asset Shipment identified by shipmentId {
o ShipmentStatus status
o Long unitCount
--> Contract contract
o TemperatureReading[] temperatureReadings optional
o AccelReading[] AccelReadings optional
o GpsReading[] gpsReadings optional

}

/**
Expand All @@ -131,7 +114,6 @@ asset Contract identified by contractId {
o Double maxTemperature
o Double minPenaltyFactor
o Double maxPenaltyFactor
o Double maxAccel
}

/**
Expand Down Expand Up @@ -175,38 +157,25 @@ participant Importer extends Business {
* JUST FOR INITIALIZING A DEMO
*/
transaction SetupDemo {
}
}

/**
* An event - when the temperature goes outside the agreed-upon boundaries
*/
event TemperatureThresholdEvent {
o String message
o Double temperature
o String latitude
o String longitude
o String readingTime
--> Shipment shipment

}

/**
* An event - when the acceleration event has been detected
*/
event AccelerationThresholdEvent {
o String message
o Double accel_x
o Double accel_y
o Double accel_z
o String latitude
o String longitude
o String readingTime
--> Shipment shipment

}

/**
* An event - when the ship arrives at the port
*/
event ShipmentInPortEvent {
o String message
--> Shipment 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

0 comments on commit c189b54

Please sign in to comment.