<feat> 모터 상태 api통신
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
@@ -7,6 +8,8 @@ public class AppManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ProgramView view;
|
||||
[SerializeField] private RobotController robotController;
|
||||
[SerializeField] private float motorStatePollInterval = 1.0f;
|
||||
ProgramPresenter presenter;
|
||||
private string hostip;
|
||||
private int tcpPort;
|
||||
private int udpPort;
|
||||
@@ -19,10 +22,14 @@ public class AppManager : MonoBehaviour
|
||||
ProgramModel model = new ProgramModel(hostip, tcpPort);
|
||||
await model.InitializeAsync();
|
||||
|
||||
ProgramPresenter presenter = new ProgramPresenter(model, view);
|
||||
presenter = new ProgramPresenter(model, view);
|
||||
presenter.RegisterControlledRobot(robotController);
|
||||
|
||||
await presenter.UpdateMotorStateAsync();
|
||||
|
||||
view.DisplayProgram(null);
|
||||
|
||||
StartCoroutine(PollMotorStateCoroutine());
|
||||
}
|
||||
|
||||
private void LoadConfig()
|
||||
@@ -116,4 +123,14 @@ public class AppManager : MonoBehaviour
|
||||
udpPort = defaultPort;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator PollMotorStateCoroutine()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(motorStatePollInterval);
|
||||
|
||||
_ = presenter.UpdateMotorStateAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user