Esempio n. 1
0
 /// <summary>
 /// 设置闪烁状态
 /// </summary>
 /// <param name="flashState">不变,正常闪烁,快速闪烁</param>
 /// <param name="flashModel">CONFIRM熄灭返回按键,当递减到“00000”按CONFIRM熄灭,按CONFIRM灯闪烁5次后熄灭返回当前数值</param>
 /// <param name="flashSwitchBit"></param>
 public void SetFlashState(FlashState flashState, FlashModel flashModel, int flashSwitchBit)
 {
     byte[] switchBit = BitConverter.GetBytes(flashSwitchBit);
     ((Protocal)this.Com.Encoder).BtFlashState[0] = switchBit[0];
     ((Protocal)this.Com.Encoder).BtFlashState[1] = (byte)((switchBit[1] & 0X3FFF) ^ (byte)((byte)flashState << 6));
     ((Protocal)this.Com.Encoder).BtFlashState[2] = (byte)flashModel;
 }
Esempio n. 2
0
 /// <summary>
 /// It reads the Flash-Card App-Template, from the .buildmlearn file.
 /// </summary>
 /// <param name="fileName">Name of the file</param>
 public static void readFlashFile(string fileName)
 {
     try
     {
         FlashModel  model    = FlashModel.getInstance();
         List <Card> cardList = new List <Card>();
         XmlDocument doc      = new XmlDocument();
         doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
         model.setFlashName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
         model.setFlashDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
         string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
         model.setFlashAuthor(author[1].Trim());
         model.setFlashAuthorEmail(author[2].Trim());
         model.setFlashVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
         XmlNodeList item = doc.GetElementsByTagName("item");
         // looping through all item nodes <app>
         for (int i = 0; i < item.Length; i++)
         {
             string[] ar   = item.ElementAt(i).InnerText.Split('\n');
             Card     card = new Card(ar[1].Trim(), ar[2].Trim(), ar[3].Trim(), ar[4].Trim());
             cardList.Add(card);
         }
         model.setCardList(cardList);
     }
     catch (Exception) { }
 }
Esempio n. 3
0
 /// <summary>
 /// ������˸״̬
 /// </summary>
 /// <param name="flashState">����,������˸,������˸</param>
 /// <param name="flashModel">CONFIRMϨ�𷵻ذ���,���ݼ�����00000����CONFIRMϨ��,��CONFIRM����˸5�κ�Ϩ�𷵻ص�ǰ��ֵ</param>
 /// <param name="flashSwitchBit"></param>
 public void SetFlashState(FlashState flashState, FlashModel flashModel, int flashSwitchBit)
 {
     byte[] switchBit = BitConverter.GetBytes(flashSwitchBit);
     ((Protocal)this.Com.Encoder).BtFlashState[0] = switchBit[0];
     ((Protocal)this.Com.Encoder).BtFlashState[1] = (byte)((switchBit[1] & 0X3FFF) ^ (byte)((byte)flashState << 6));
     ((Protocal)this.Com.Encoder).BtFlashState[2] = (byte)flashModel;
 }