This repository has been archived by the owner on Oct 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
9,069 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4,275 changes: 4,275 additions & 0 deletions
4,275
AnnelidaDispatcher/Model/DataTransmission/AnnelidaSensors.cs
Large diffs are not rendered by default.
Oops, something went wrong.
169 changes: 169 additions & 0 deletions
169
AnnelidaDispatcher/Model/DataTransmission/annelida_sensors.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
enum SolenoidState{ | ||
|
||
UNKNOW_SOLENOID = 0; | ||
ACTIVED = 1; | ||
DISABLED = 2; | ||
} | ||
enum CylinderState{ | ||
|
||
UNKNOW_CYLINDER = 0; | ||
ADVANCED = 1; | ||
WITHDRAWN = 2; | ||
} | ||
|
||
message AnnelidaSensors { | ||
|
||
message UmbilicalReception{ | ||
uint32 traction = 1; | ||
} | ||
|
||
message NotRegulatedConverter{ | ||
|
||
repeated float internal_temperature = 1; | ||
repeated float internal_pressure = 2; | ||
repeated float electrical_current = 3; | ||
repeated float electrical_power = 4; | ||
repeated float electrical_tension_700v = 5; | ||
} | ||
|
||
message RegulatedConverter{ | ||
|
||
repeated float internal_temperature = 1; | ||
repeated float internal_pressure = 2; | ||
repeated float electrical_current = 3; | ||
repeated float electrical_power = 4; | ||
repeated float electrical_tension = 5; | ||
} | ||
|
||
message EmbeddedSystem{ | ||
|
||
repeated float internal_temperature = 1; | ||
repeated float internal_pressure = 2; | ||
repeated float external_module_pressure = 3; | ||
repeated float rotation_x = 4; | ||
repeated float rotation_y = 5; | ||
repeated float rotation_z = 6; | ||
repeated float displacement_x = 7; | ||
repeated float displacement_y = 8; | ||
repeated float displacement_z = 9; | ||
repeated float acceleration_x = 10; | ||
repeated float acceleration_y = 11; | ||
repeated float acceleration_z = 12; | ||
} | ||
|
||
message MotorController{ | ||
|
||
repeated float internal_temperature = 1; | ||
repeated float internal_pressure = 2; | ||
repeated float electrical_current = 3; | ||
repeated float electrical_tension = 4; | ||
} | ||
|
||
message Locomotive{ | ||
|
||
repeated CylinderState cylinder_forward = 1; | ||
repeated CylinderState cylinder_backward = 2; | ||
} | ||
|
||
message PumpsEngine{ | ||
|
||
message Manifold_1_Backward{ | ||
|
||
repeated SolenoidState solenoid_cylinder_move_backward = 1; | ||
repeated SolenoidState solenoid_cylinder_active_backward = 2; | ||
} | ||
message Manifold_3_Backward{ | ||
|
||
repeated SolenoidState solenoid_active_foot_backward = 1; | ||
} | ||
message MotorBomb_1{ | ||
|
||
repeated float oil_temperature = 1; | ||
repeated uint32 motor_rpm = 2; | ||
repeated float motor_power = 3; | ||
} | ||
message MotorBomb_2{ | ||
|
||
repeated uint32 motor_rpm = 1; | ||
repeated float motor_power = 2; | ||
|
||
} | ||
message Manifold_2_Auxiliar{ | ||
|
||
repeated float hydraulic_foots_pressure = 1; | ||
repeated SolenoidState solenoid_pressure_foots = 2; | ||
} | ||
message MotorBombAuxiliar{ | ||
|
||
repeated float temperature_sensor = 1; | ||
repeated uint32 motor_rpm = 2; | ||
repeated float motor_power = 3; | ||
} | ||
message Manifold_2_Main{ | ||
|
||
repeated float hydraulic_cylinder_pressure = 1; | ||
repeated SolenoidState solenoid_move_pressure = 2; | ||
} | ||
message MotorBomb_3{ | ||
|
||
repeated float motor_rpm = 1; | ||
repeated float motor_power = 2; | ||
} | ||
message MotorBomb_4{ | ||
|
||
repeated float oil_temperature = 1; | ||
repeated uint32 motor_rpm = 2; | ||
repeated float motor_power = 3; | ||
} | ||
message Manifold_3_Forward{ | ||
|
||
repeated SolenoidState solenoid_active_forward = 1; | ||
} | ||
message Manifold_1_Forward{ | ||
|
||
repeated SolenoidState solenoid_cylinder_move_forward = 1; | ||
repeated SolenoidState solenoid_cylinder_active_forward = 2; | ||
} | ||
|
||
Manifold_1_Backward enc_manifold_1_backward = 1; | ||
Manifold_3_Backward enc_manifold_3_backward = 2; | ||
MotorBomb_1 enc_motor_bomb_1 = 3; | ||
MotorBomb_2 enc_motor_bomb_2 = 4; | ||
Manifold_2_Auxiliar enc_manifold_2_auxiliar = 5; | ||
MotorBombAuxiliar enc_motor_bomb_auxiliar = 6; | ||
Manifold_2_Main enc_manifold_2_main = 7; | ||
MotorBomb_3 enc_motor_bomb_3 = 8; | ||
MotorBomb_4 enc_motor_bomb_4 = 9; | ||
Manifold_3_Forward enc_manifold_3_forward = 10; | ||
Manifold_1_Forward enc_manifold_1_forward = 11; | ||
} | ||
message SgnReactor{ | ||
repeated float sgn_temperature = 1; | ||
repeated bool obstruction_detected = 2; | ||
repeated float reactor_pressure = 3; | ||
} | ||
|
||
|
||
google.protobuf.Timestamp timestamp = 1; | ||
|
||
UmbilicalReception enc_reception = 2; | ||
NotRegulatedConverter enc_not_regulated_1 = 3; | ||
NotRegulatedConverter enc_not_regulated_2 = 4; | ||
RegulatedConverter enc_regulated_1 = 5; | ||
RegulatedConverter enc_regulated_2 = 6; | ||
EmbeddedSystem enc_embedded_system = 7; | ||
MotorController enc_motor_controller_1 = 8; | ||
MotorController enc_motor_controller_2 = 9; | ||
MotorController enc_motor_controller_3 = 10; | ||
MotorController enc_motor_controller_4 = 11; | ||
MotorController enc_motor_controller_5 = 12; | ||
Locomotive enc_forward_locomotive = 13; | ||
Locomotive enc_backward_locomotive = 14; | ||
PumpsEngine system_pumps = 15; | ||
SgnReactor enc_reactor = 16; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using System.Net; | ||
using System.Net.Sockets; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using MongoDB.Bson; | ||
using MongoDB.Bson.IO; | ||
using MongoDB.Bson.Serialization; | ||
using MongoDB.Bson.Serialization.Serializers; | ||
|
||
namespace AnnelidaDispatcher.Model.Server | ||
{ | ||
public class BsonServer : AsyncAbstractServer | ||
{ | ||
public BsonServer(int tcpPort) : base(tcpPort) | ||
{ | ||
|
||
} | ||
|
||
protected override void HandleMessage(byte[] buffer, int ammountRead,ClientTypes.Types myType) | ||
{ | ||
var message = ProcessSerializedBson(buffer, ammountRead); | ||
|
||
messageDispatchStrategy.RedespatchMessage(message.ToBson(), connectedClients, myType); | ||
} | ||
private BsonDocument ProcessSerializedBson(byte[] bytes, int packageSize) | ||
{ | ||
|
||
try | ||
{ | ||
var doc = BsonSerializer.Deserialize<BsonDocument>(bytes); | ||
BsonDateTime timestamp = DateTime.UtcNow; | ||
doc["timestamp"] = timestamp; | ||
return doc; | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.ToString()); | ||
|
||
return null; | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.