Skip to content

Commit 92d50f7

Browse files
created service manager
Co-Authored-By: Nazif Furkan <nazif-furkan@users.noreply.github.com>
1 parent 9a3299e commit 92d50f7

35 files changed

+4876
-0
lines changed

Assembly-CSharp.csproj.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Assets/CovisartMotionSDK.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using SimulatorBackgroundWorkerService.CommonClasses;
5+
using UnityEngine;
6+
7+
namespace CovisartMotionSDK
8+
{
9+
public class AircraftData : MonoBehaviour
10+
{
11+
public GameObject jet;
12+
public double axisX;
13+
public double axisY;
14+
public double axisZ;
15+
public double axisW;
16+
public Vector3 eulerAngle;
17+
public Vector3 position;
18+
19+
20+
private SimulatorCommandData commandaData;
21+
void Awake()
22+
{
23+
commandaData = new SimulatorCommandData();
24+
}
25+
void Update()
26+
{
27+
axisX = jet.transform.eulerAngles.x ;
28+
axisY = jet.transform.eulerAngles.y ;
29+
axisZ = jet.transform.eulerAngles.z ;
30+
axisW = jet.transform.rotation.w ;
31+
eulerAngle = jet.transform.eulerAngles;
32+
position = jet.transform.position;
33+
}
34+
public void StartDataTransfer()
35+
{
36+
SendData(commandaData.OpenConnection());
37+
SendData(commandaData.PowerOn());
38+
SendData(commandaData.EnableExactPositonX());
39+
SendData(commandaData.EnableExactPositonY());
40+
var state = SendData(commandaData.GetState());
41+
Debug.Log(state);
42+
}
43+
private static string SendData(byte[] bits)
44+
{
45+
return MyTcpClient.Connect("127.0.0.1", bits);
46+
}
47+
}
48+
}
49+

Assets/CovisartMotionSDK/AircraftData.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using SimulatorBackgroundWorkerService.CommonClasses;
2+
using CovisartCommunicationSDK;
3+
using UnityEngine;
4+
5+
namespace CovisartMotionSDK
6+
{
7+
public class CovisartSDK : MonoBehaviour
8+
{
9+
public GameObject Aircraft;
10+
private static CommunicationSDK _communication;
11+
private AxisData _axisData;
12+
private SimulatorCommandData _commandData;
13+
public bool IsDataTransferStarted = false;
14+
void Awake()
15+
{
16+
_commandData = new SimulatorCommandData();
17+
}
18+
public void OpenConnection()
19+
{
20+
SendData(_commandData.OpenConnection());
21+
Debug.Log("Connection started");
22+
}
23+
public void PowerMotors()
24+
{
25+
SendData(_commandData.PowerOn());
26+
Debug.Log("Motors Powered");
27+
}
28+
29+
public void StartExactPosition()
30+
{
31+
SendData(_commandData.EnableExactPositonX());
32+
SendData(_commandData.EnableExactPositonY());
33+
var state = SendData(_commandData.GetState());
34+
Debug.Log(state);
35+
}
36+
37+
public void StartDataListener()
38+
{
39+
SendData(_commandData.StartArmaThread());
40+
}
41+
42+
public void StartDataTransfer()
43+
{
44+
_communication = new CommunicationSDK();
45+
var state = _communication.StartCommunication();
46+
if(state.hasError)
47+
Debug.Log(state.errorMessage);
48+
else
49+
{
50+
IsDataTransferStarted = true;
51+
}
52+
}
53+
54+
public void StopDataTransfer()
55+
{
56+
if(_communication == null)
57+
_communication = new CommunicationSDK();
58+
var state = _communication.StopCommunication();
59+
if(state.hasError)
60+
Debug.Log(state.errorMessage);
61+
}
62+
63+
private void SendOfData(string axisX, string axisY)
64+
{
65+
_axisData = new AxisData {AxisX = axisX, AxisY = axisY};
66+
var state = _communication.SendData(_axisData);
67+
if(state.hasError)
68+
Debug.Log(state.errorMessage);
69+
}
70+
71+
void Update()
72+
{
73+
if (!IsDataTransferStarted) return;
74+
var x = Aircraft.transform.eulerAngles.x.ToString();
75+
var y = Aircraft.transform.eulerAngles.y.ToString();
76+
SendOfData(x, y);
77+
}
78+
79+
/*void FixedUpdate()
80+
{
81+
var state = SendData(_commandData.GetState());
82+
Debug.Log(state);
83+
}*/
84+
85+
private static string SendData(byte[] bits)
86+
{
87+
return MyTcpClient.Connect("127.0.0.1", bits);
88+
}
89+
}
90+
}
91+

Assets/CovisartMotionSDK/CovisartSDK.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/x64.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/x64/CovisartSimulatorSDK.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

0 commit comments

Comments
 (0)