Skip to content

Commit

Permalink
例外検出&シャットダウンを追加、範囲チェックを追加、誤ってソースをダウンロードする人向けの注意追加
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsnmeajp committed Feb 21, 2020
1 parent ca050c9 commit 503bc5b
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 24 deletions.
14 changes: 13 additions & 1 deletion EVMC4U/CameraReceiver.cs
Expand Up @@ -124,7 +124,19 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)

StatusMessage = "OK";

ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e)
{
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}

if (!externalReceiverManager.SendNextReceivers(message, callCount))
{
Expand Down
25 changes: 20 additions & 5 deletions EVMC4U/CommunicationValidator.cs
Expand Up @@ -124,7 +124,19 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)
CallCountMonitor = callCount;
StatusMessage = "OK";

ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e)
{
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}

if (!externalReceiverManager.SendNextReceivers(message, callCount))
{
Expand Down Expand Up @@ -154,11 +166,14 @@ private void ProcessMessage(ref uOSC.Message message)
StatusMessage = "OK";
}

//V2.5 キャリブレーション状態
if ((message.values[1] is int) && (message.values[2] is int))
//V2.5 キャリブレーション状態(長さ3以上)
if (message.values.Length >= 3)
{
calibrationState = (CalibrationState)message.values[1];
calibrationMode = (CalibrationMode)message.values[2];
if ((message.values[1] is int) && (message.values[2] is int))
{
calibrationState = (CalibrationState)message.values[1];
calibrationMode = (CalibrationMode)message.values[2];
}
}
}
//データ送信時刻
Expand Down
14 changes: 13 additions & 1 deletion EVMC4U/DeviceReceiver.cs
Expand Up @@ -111,7 +111,19 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)

StatusMessage = "OK";

ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e)
{
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}

if (!externalReceiverManager.SendNextReceivers(message, callCount))
{
Expand Down
14 changes: 13 additions & 1 deletion EVMC4U/DirectionalLightReceiver.cs
Expand Up @@ -83,7 +83,19 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)

StatusMessage = "OK";

ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e)
{
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}

if (!externalReceiverManager.SendNextReceivers(message, callCount))
{
Expand Down
44 changes: 29 additions & 15 deletions EVMC4U/ExternalReceiver.cs
Expand Up @@ -274,7 +274,18 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)

//メッセージを処理
if (!Freeze) {
ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e) {
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}
}

//次のデイジーチェーンへ伝える
Expand Down Expand Up @@ -322,23 +333,26 @@ private void ProcessMessage(ref uOSC.Message message)
StatusMessage = "Waiting for [Load VRM]";
}

//V2.5 キャリブレーション状態
if ((message.values[1] is int) && (message.values[2] is int))
{
int calibrationState = (int)message.values[1];
int calibrationMode = (int)message.values[2];
//V2.5 キャリブレーション状態(長さ3以上)
if (message.values.Length >= 3) {
if ((message.values[1] is int) && (message.values[2] is int))
{
int calibrationState = (int)message.values[1];
int calibrationMode = (int)message.values[2];

//キャリブレーション出来ていないときは隠す
if (HideInUncalibrated && Model != null) {
Model.SetActive(calibrationState == 3);
}
//スケール同期をキャリブレーションと連動させる
if (SyncCalibrationModeWithScaleOffsetSynchronize) {
RootScaleOffsetSynchronize = !(calibrationMode == 0); //通常モードならオフ、MR系ならオン
}
//キャリブレーション出来ていないときは隠す
if (HideInUncalibrated && Model != null)
{
Model.SetActive(calibrationState == 3);
}
//スケール同期をキャリブレーションと連動させる
if (SyncCalibrationModeWithScaleOffsetSynchronize)
{
RootScaleOffsetSynchronize = !(calibrationMode == 0); //通常モードならオフ、MR系ならオン
}

}
}

return;
}
//データ送信時刻
Expand Down
14 changes: 13 additions & 1 deletion EVMC4U/InputReceiver.cs
Expand Up @@ -103,7 +103,19 @@ public void MessageDaisyChain(ref uOSC.Message message, int callCount)

StatusMessage = "OK";

ProcessMessage(ref message);
//異常を検出して動作停止
try
{
ProcessMessage(ref message);
}
catch (Exception e)
{
StatusMessage = "Error: Exception";
Debug.LogError(" --- Communication Error ---");
Debug.LogError(e.ToString());
shutdown = true;
return;
}

if (!externalReceiverManager.SendNextReceivers(message, callCount))
{
Expand Down
Empty file.

0 comments on commit 503bc5b

Please sign in to comment.