No description, website, or topics provided.
Java HTML JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
internet
java
README.md

README.md

#Festo controller

##Overview

Java project

This project has two parts.

The first part is the server that receive messages from clients, defined by our protocol discribed later, and notify the other clients connected to it of the changes.

The second part is a graphical user interface (GUI), to give us the status of the machine and also through it change the status of the machine, by execute a file of statements or simply by click on the number of pipe to open/close.

###About the server The server is listening on port 3001 (it can change according to needs). We have defined a simple protocol using json for communication between clients and the server. The server after handling a request it check if the request is correct broadcast the request to other clients and execute it on the machine.

###Our protocol

All request message has this form:

{ 
	"msg_id": "integer",
	"type": "string",
	"content": "json object"
}
key type description
msg_id integer The id of the message
type string The type of the message
content json object The content of the request

All response has this form:

{ 
	"msg_id": "integer",
	"type": "string",
	"status_code": "string",
	"content": "json object"
}
key type description
msg_id integer The same as the request
type string The same as the request appending to it with ".Response"
status_code string The status of the response
content json object The content of the response

###The messages types

Request: "GetStatusPipes"

This request is to get the current status of the pipes on the machine.

{}

Exemple:

{
	"msg_id": 0,
	"type": "GetStatusPipes",
	"content": {}
}

Response "GetStatusPipes.Response"

{
	"status_pipes": "integer"
}

Exemple:

{
	"msg_id": 0,
	"type": "GetStatusPipes.Response",
	"status_code": "SUCCESS",
	"content": {
		"status_pipes": 65535
	}
}

Request: "OpenPipes"

This request is to open pipes on the machine.

{
	"pipes": ["integer"]
}

Exemple:

{
	"msg_id": 0,
	"type": "OpenPipes",
	"content": {
		"pipes": [1,3,5,7]
	}
}

Response "OpenPipes.Response"

{
	"status_pipes": "integer"
}

Exemple:

{
	"msg_id": 0,
	"type": "OpenPipes.Response",
	"status_code": "SUCCESS",
	"content": {
		"status_pipes": 65535
	}
}

Request: "ClosePipes"

This request is to close pipes on the machine.

{
	"pipes": ["integer"]
}

Exemple:

{
	"msg_id": 0,
	"type": "ClosePipes",
	"content": {
		"pipes": [2,4,6,8]
	}
}

Response "ClosePipes.Response"

{
	"status_pipes": "integer"
}

Exemple:

{
	"msg_id": 0,
	"type": "ClosePipes.Response",
	"status_code": "SUCCESS",
	"content": {
		"status_pipes": 65535
	}
}

Another type of messages we called them "notification"

These messages is from server to clients and they are called "notification" because we not request them.

Notification "StatusPipes"

{
	"status_pipes": "integer"
}

Exemple:

{
	"msg_id": 0,
	"type": "Notification.StatusPipes",
	"status_code": "SUCCESS",
	"content": {
		"status_pipes": 65535
	}
}

###How to use

  • You need to connect the computer that execute the server by ethernet to the machine.
  • You need to be on the same lan, the ip of the machine is "192.168.2.50" and its mask is "255.255.255.0"

####Installing

  1. You need to clone this project on your computer
  2. Add the dependencies from the directory "/java/lib" in your solution
  3. Compile the code
  4. Run the file "/java/broker/src/app/App.java"

##Internet project

Internet project is a web client for the machine.

###How to use

Browse to the directory "/internet/", install dependencies and run the server.

npm install
npm start
  • Launch a browser and go to "http://localhost:3000" or if you want to access from outside you need to know the ip of the server and go to "http://{THE-IP}:3000".