protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); // Set sensors instances this.AccelerometerReader = new AccelerometerReader(); this.GyroscopeReader = new GyroscopeReader(); this.OrientationReader = new OrientationReader(); this.Vibrate = new Vibrate(); // Init media player this.MediaPlayer = new MediaPlayer(); this.MediaPlayerReading = false; // Find ihm selectors this.TvMessage = FindViewById <TextView>(Resource.Id.tv_message); this.BtVoice1 = FindViewById <Button>(Resource.Id.bt_voice_1); this.BtVoice2 = FindViewById <Button>(Resource.Id.bt_voice_2); this.BtVoiceOff = FindViewById <Button>(Resource.Id.bt_voice_off); this.BtVibrate = FindViewById <Button>(Resource.Id.bt_vibrate); this.Count = 0; this.CountSequences = 0; this.VoiceChoice = 0; this.CountShake = 0; this.DroppedPhoneTable = false; this.DroppedPhoneStatus = false; this.Reset = false; // Callbacks this.BtVibrate.Click += this.OnClick_TestVibrate; this.BtVoice1.Click += this.OnClick_Voice1; this.BtVoice2.Click += this.OnClick_Voice2 ; this.BtVoiceOff.Click += this.OnClick_VoiceOff; if (!this.AccelerometerReader.Started) { this.AccelerometerReader.ToggleAccelerometer(); } }
private JmadDataContainer(Span <byte> data) { this.Data = data; this.Type = (JmadDataType)data[0]; this.OrientationCount = data[1]; this.TranslationCount = data[2]; this.ScaleCount = data[3]; this.OrientationOffset = -1; this.TranslationOffset = -1; this.ScaleOffset = -1; this.OrientationSize = -1; this.TranslationSize = -1; this.ScaleSize = -1; this.OrientationVariableSizeBlockOffset = -1; this.TranslationVariableSizeBlockOffset = -1; this.ScaleVariableSizeBlockOffset = -1; this.ReversedVariableSizeBlocks = false; this.OrientationFrameMapping = -1; this.TranslationFrameMapping = -1; this.ScaleFrameMapping = -1; this.ShortsForFrameMapping = false; this.orientationReader = ReadCompressedQuat; this.orientationElementSize = 8; if (this.Type == JmadDataType.UncompressedNormal) { this.orientationReader = ReadQuat; this.orientationElementSize = 16; } this.translationReader = ReadVec3; this.translationElementSize = 12; }