示例#1
0
        private void SendUpdates_Click(object sender, EventArgs e)
        {
            List <Update> updates = Database.GetUpdates();

            if (updates.Count == 0)
            {
                sendProgress.Text = "No Updates to Send.";
                return;
            }

            if (BlueTooth.Test())
            {
                sendProgress.Text = "Failed to Send Updates.";
                return;
            }
            else
            {
                sendProgress.Text = "Sending Updates...";

                foreach (Update update in updates)
                {
                    BlueTooth.SendRecord(update.UpdateText);
                }
            }

            sendProgress.Text = "Updates Sent.";

            Database.ClearUpdates();
        }
示例#2
0
 private void bnClose_Click(object sender, EventArgs e)
 {
     if (AssertResult(BlueTooth.S10_Close()))
     {
         bnClose.Enabled = false;
         bnOpen.Enabled  = true;
     }
 }
示例#3
0
 private void bnOpen_Click(object sender, EventArgs e)
 {
     if (AssertResult(BlueTooth.S10_Init((S10_Coms)(S10_Coms.COM1 + cbbCom.SelectedIndex))))
     {
         bnClose.Enabled = true;
         bnOpen.Enabled  = false;
     }
 }
示例#4
0
        private void bnSoftVersion_Click(object sender, EventArgs e)
        {
            byte[] bstr = new byte[1024];
            uint   ulen = 1024;

            if (AssertResult(BlueTooth.S10_GetModuleVersion(bstr, ref ulen)))
            {
                bstr[ulen] = 0;
                MessageBox.Show(Encoding.ASCII.GetString(bstr, 0, (int)ulen));
            }
        }
示例#5
0
            public override void OnReceive(Context context, Intent intent)
            {
                List <String>    StringToSend = new List <string>();
                List <BlueTooth> ListToSend   = new List <BlueTooth>();

                string action = intent.Action;

                if (BluetoothDevice.ActionFound.Equals(action))
                {
                    BluetoothDevice device                = (BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);
                    String          deviceName            = device.Name;
                    String          deviceHardwareAddress = device.Address; // MAC address

                    BlueTooth btnew = new BlueTooth();
                    btnew.DeviceName = deviceName;
                    btnew.MacAddr    = deviceHardwareAddress;
                    bInstance.bListToSend.Add(btnew);
                    System.Diagnostics.Debug.WriteLine("Found Device: " + deviceName);
                }
                else if (BluetoothAdapter.ActionDiscoveryStarted.Equals(action))
                {
                    System.Diagnostics.Debug.WriteLine("BT Discovery Started");

                    StringToSend          = new List <string>();
                    bInstance.bListToSend = new List <BlueTooth>();
                }
                else if (BluetoothAdapter.ActionDiscoveryFinished.Equals(action))
                {
                    System.Diagnostics.Debug.WriteLine("BT Discovery Finished");

                    for (int i = 0; i < bInstance.bListToSend.Count; i++)
                    {
                        StringToSend.Add(bInstance.bListToSend[i].DeviceName + "   " + bInstance.bListToSend[i].MacAddr);
                    }

                    Views.MainPage.staticList.ItemsSource = StringToSend;
                    BlueTooth.staticBlueList = new List <BlueTooth>(bInstance.bListToSend);
                    ViewModels.MainPageViewModel.isUpdatedList = true;
                    Views.MainPage.staticLabel.Text            = "Scanning Finished";


                    bInstance.Finish();
                }
            }
示例#6
0
        public void SendOrder(OrderModel model)
        {
            BlueTooth.SaveOrder(model);

            foreach (OrderItemModel itemModel in model.OrderItems)
            {
                BlueTooth.AddOrderItem(itemModel);

                foreach (OrderItemComponentModel componentModel in itemModel.ComponentModels)
                {
                    //OrderItemComponent newComponent = new OrderItemComponent(0, itemModel.Id, componentModel.Id, componentModel.Portions);
                    BlueTooth.AddOrderItemComponent(componentModel);

                    foreach (OrderItemComponentComponentModel subComponentModel in componentModel.Components)
                    {
                        BlueTooth.AddOrderItemComponentComponent(subComponentModel);
                    }
                }
            }

            BlueTooth.SendRecord("END_OF_ORDER");
        }
示例#7
0
 public void UnlockOrderItem(int id)
 {
     BlueTooth.UnlockOrderItem(id);
 }
示例#8
0
 public void LockOrderItem(int id)
 {
     BlueTooth.LockOrderItem(id);
 }
示例#9
0
 public void SendVoidOrder(OrderModel model)
 {
     BlueTooth.DeleteOrder(model);
 }
示例#10
0
 private void bnReboot_Click(object sender, EventArgs e)
 {
     AssertResult(BlueTooth.S10_Reboot());
 }
示例#11
0
 private void bnSetMode_Click(object sender, EventArgs e)
 {
     AssertResult(BlueTooth.S10_SetOperationMode((S10_OperationMode)cbbMode.SelectedIndex));
 }