private void DecodeMessage(string message) { try { EMG newInput = (EMG)Byte.Parse(message); if (lastInput.Equals(EMG.None) && !lastInput.Equals(newInput)) { //Debug.Log("Rising Edge" + newInput); //controller.Do(newInput); alreadyPressed = false; lastInput = newInput; } else if (newInput.Equals(EMG.None) && !lastInput.Equals(newInput)) // This is assuming it always reaches 0 before other input { //Debug.Log("Falling Edge" + newInput); lastInput = newInput; alreadyPressed = false; } if (newInput.Equals(EMG.None)) { lastInput = newInput; alreadyPressed = false; } } catch (Exception e) { Debug.Log(e.ToString()); } }
public void Initialize() { EMG emg = new EMG(); emg.Initialize(); //takes a lot of time waitHandler.WaitOne(); emg.Start(); }
void Start() { lastInput = EMG.None; alreadyPressed = false; thread = new Thread(StartReceiver); thread.Priority = System.Threading.ThreadPriority.BelowNormal; thread.Start(); }
public bool getButtonInput(EMG emg) { if (lastInput.Equals(emg) && !alreadyPressed && !lastInput.Equals(EMG.None)) { //Debug.Log("Pressed " + emg.ToString() + " last input : " + lastInput.ToString()); alreadyPressed = true; return(true); } return(false); }
/// <summary> /// depo transfer fişi /// </summary> public Result DepoTransfer(List <frmUysWaitingTransfer> tbl, EMG2 emir, bool GirisMi) { // add to list var DepTranList = new List <DepTran>(); foreach (var item in tbl) { DepTranList.Add(new DepTran() { EvrakNo = tbl[0].EvrakNo, Tarih = tbl[0].Tarih.FromOaDate(), MalKodu = item.MalKodu, Miktar = item.Miktar, Birim = item.Birim, SeriNo = item.SeriNo, CikisDepo = GirisMi == true ? item.AraDepo : item.CikisDepo, GirisDepo = GirisMi == true ? item.GirisDepo : item.AraDepo, Kaydeden = item.Kaydeden, KayitSurum = "9.01.028", KayitKaynak = 74 }); } var Emir = new EMG(); if (emir != null) { Emir.DefaultValueSet(); Emir.EmirNo = emir.EmirNo; Emir.IcDis = 11; Emir.BasTarih = emir.BasTarih; Emir.BasSaat = emir.BasSaat; Emir.Talimat2 = emir.Talimat2; Emir.Kod2 = emir.Kod2; Emir.Kod3 = emir.Kod3; Emir.StiNo = emir.StiNo; Emir.KayitTarih = emir.KayitTarih; Emir.KayitSaat = emir.KayitSaat; Emir.BitTarih = emir.BitTarih; Emir.BitSaat = emir.BitSaat; Emir.Talimat3 = emir.Talimat3; Emir.TrsfrNo = emir.TrsfrNo; Emir.RecID = emir.RecID; Emir.Birim = emir.Birim; Emir.CurDurum = emir.CurDurum; Emir.CurDurSb = emir.CurDurSb; Emir.SonDurSb = emir.SonDurSb; Emir.PlOnay = emir.PlOnay; Emir.YMUret = emir.YMUret; Emir.YMMly = emir.YMMly; Emir.YMEndMly = emir.YMEndMly; Emir.YMDepo = emir.YMDepo; Emir.YMHmdCik = emir.YMHmdCik; Emir.Teklif = emir.Teklif; Emir.KayitTuru = emir.KayitTuru; // emir details Emir.Kaydeden = tbl[0].Kaydeden; Emir.KayitKaynak = 10; Emir.KayitSurum = "1.00"; Emir.Degistiren = tbl[0].Kaydeden; Emir.DegisTarih = DateTime.Today.ToOADateInt(); Emir.DegisSaat = DateTime.Now.ToOaTime(); Emir.DegisKaynak = 10; Emir.DegisSurum = "1.00"; Emir.CheckSum = 1542; } // save 2 db var StokIslem = new Stok_Islemleri(SirketKodu, SqlExper); return(StokIslem.DepoTransfer_EMG_Kayit(DepTranList, emir == null ? null : Emir, tbl[0].Kaydeden2)); }