Table of contents
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
- Pour ajouter un liens a une encre il faut éditer ce liens, aller dans Avancé, #nameAncre et écrire le label du liens
Quick navigation
Child pages (Children Display) | ||||
---|---|---|---|---|
|
title | Goal |
---|
Description du systeme
This system, based on our understanding of intelligent micro-system, is composed of the following organs:
Nerve center: where the hub and its data are located.
Admin dashboard: the administration interface of your hub.
VirtualTemperatureSensor organ: simulate the temperature sensor of the wine cellar continuously and synchronize the samples with the hub.
Analytics organ: analyzes the temperature and alerts if the temperature is ok or not.
Monitoring interface organ: a web interface, displaying the current status of our wine cellar.
title | Creating a new Spinal System |
---|
Install spinal-system-basic
language | bash |
---|---|
theme | DJango |
Launch spinal-system
Code Block | ||||
---|---|---|---|---|
| ||||
~/button-system$ pm2 start launch.config.js |
PM2 will automatically start the Spinal Hub and the organs. Take care, if you have another hub running on port 7777, your new hub will not be launched ! (here is a command to see what port are used on ubuntu: sudo netstat -lp --inet)
After this installation, only SpinalHub is running on port 7777. SpinalHub containes a web server that provide his own Admin interface. Here is the architecture of the system you have after this first install:
Connect to Admin UI
As we have done in the getting started, connect to the admin dashboard to see if you hub is running :
Panel | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
NodeJS versionInstall the package from npm:
You can require the module in the standard way:
|
Panel | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
This method establishes a connection with the hub. It returns an object containing the connection information, which will be used in the other API methods that communicate with the hub. The string parameter has the following format:
Explanation:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
A Model is a class, which contains a structure of the data we want to synchronize with the hub. There are three required steps to define a class:
The value of the attributes should correspond to one of these data types:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
A model object is created as an instance of a Model class, and then saved in the hub with the store() method. All the changes made in it will be automatically submited to the hub. The parameters accepted are:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
Once an object has been saved in the hub, this command is used for fetching it and keeping synchronized with its changes. The parameters accepted are:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
Once some objects have been saved in the hub, this command is used for fetching all the models of a specific class and keeping synchronized with their changes. The parameters accepted are:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
To obtain or modify an attribute of the model object, the classic get() and set() methods should be applied. Note that if the object has previously been stored with the store() function, the modified data will automatically synchronize with the hub. |
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
A Process is a class prepared to interact with models. It can listen for changes in one or more models and reacts to them. There are three steps to define a process:
|
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
The method bind() will execute the reactFunction(), that should be defined by the developer, everytime the data in the models and it's childs are modified. |
Panel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In SpinalCoreJs, the management of users is done with a set of function of the SpinalUserManager object:
Anchor |
|
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.get_user_id('http://127.0.0.1:8888', 'test@spinalhub', 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor new_account new_account
new_account(options, user_name, password, success_callback, error_callback = null)
new_account | |
new_account |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- password: String containing the password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.new_account('http://127.0.0.1:8888', 'test@spinalhub', 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } );
|
Anchor change_password change_password
change_password(options, user_id, password, new_password, success_callback, error_callback = null)
change_password | |
change_password |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_id: Contain the user id.
- password: String containing the password of the user.
- new_password: String containing the new_password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.change_password('http://127.0.0.1:8888', 777777, 'password', 'new_password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor delete_account delete_account
delete_account(options, user_id, password, success_callback, error_callback = null)
delete_account | |
delete_account |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_id: Contain the user id.
- password: String containing the password of the user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.delete_account('http://127.0.0.1:8888', 777777, 'password',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor get_admin_id get_admin_id
get_admin_id(options, admin_name, password, success_callback, error_callback = null)
get_admin_id | |
get_admin_id |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- admin_name: String containing the admin username.
- password: String containing the password of the admin user.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.get_admin_id('http://127.0.0.1: |
The default admin account is :
client ID
title | Create a data model |
---|
title | Create our new virtualButton organ |
---|
title | Launch the system |
---|
title | Create our second organ : virtualButtonMonitor |
---|
Anchor |
|
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.change_password_by_admin('http://127.0.0.1:8888', 777777, 'new_password', 644,'4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor delete_account_by_admin delete_account_by_admin
delete_account_by_admin(options, user_name, admin_id, admin_password, success_callback, error_callback = null)
delete_account_by_admin | |
delete_account_by_admin |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- admin_id: Contain the id of a admin (default: 644 or 168)
- admin_password: String containing the password of the admin.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.delete_account_by_admin('http://127.0.0.1:8888', 777777, 644,'4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |
Anchor change_account_rights_by_admin change_account_rights_by_admin
change_account_rights_by_admin(options, user_name, right, admin_id, admin_password, success_callback, error_callback = null)
change_account_rights_by_admin | |
change_account_rights_by_admin |
- options: String the parameter to connect to the SpinalHub, example "http://127.0.0.1:8888"
- user_name: String containing the username.
- right: Contain the right (0 = Read/Write // 1 = Read).
- admin_id: Contain the id of a admin (default: 644 or 168)
- admin_password: String containing the password of the admin.
- success_callback: function callback with the response when the function succeed.
- error_callback (optionnal): function callback with the response or status error when the function fail.
Code Block | ||||
---|---|---|---|---|
| ||||
SpinalUserManager.change_account_rights_by_admin('http://127.0.0.1:8888', 'test@spinalhub', 0, '644','4YCSeYUzsDG8XSrjqXgkDPrdmJ3fQqHs',
function(response) { console.log( 'success : ' + response ) },
function(response) { console.log( 'error : ' + response ) } ); |