Exemplo n.º 1
0
    /// <summary>
    /// データ受信イベント
    /// </summary>
    /// <param name="ms"></param>
    void tServer_OnReceiveData(object sender, string ms)
    {
        var jsons = transferData.DevideData2Jsons(ms);

        foreach (var json in jsons)
        {
            var message = new HoloLensMessage();
            if (transferData.CanDesirializeJson <HoloLensMessage>(json, out message))
            {
                switch (message.sendType)
                {
                case SendType.PositionSender:     //HoloLens側のマイクロホン位置を所得
                    transferData.DesirializeJson <SendPosition>(out var sendPosition);
                    Debug.Log("[Server] Send Position num;" + sendPosition.name + " position: " + sendPosition.sendPos.x + "rotation" + sendPosition.sendRot.x);
                    positionPackages.Enqueue(sendPosition);
                    break;

                case SendType.SettingSender:
                    transferData.DesirializeJson <SettingSender>(out var holoSetting);
                    MeasurementParameter.HoloLensParameterUpdate(holoSetting);
                    Debug.Log("[Server] Holo setting ColorMapID: " + holoSetting.colorMapID);
                    logQueue.Enqueue($"Intensity range: {holoSetting.lvMin} ~ {holoSetting.lvMax}");
                    break;

                case SendType.DeleteData:
                    transferData.DesirializeJson <DeleteData>(out var deleteData);
                    deleteDatas.Enqueue(deleteData);
                    break;
                }
            }
        }
    }