<feat> 모터 상태 api통신

This commit is contained in:
SOOBEEN HAN
2025-10-24 11:55:43 +09:00
parent 5308a505a5
commit ff8afeb045
25 changed files with 77 additions and 906 deletions

View File

@@ -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();
}
}
}