Beispiel #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();
        }
Beispiel #2
0
 private void bnClose_Click(object sender, EventArgs e)
 {
     if (AssertResult(BlueTooth.S10_Close()))
     {
         bnClose.Enabled = false;
         bnOpen.Enabled  = true;
     }
 }
Beispiel #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;
     }
 }
Beispiel #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));
            }
        }
Beispiel #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();
                }
            }
Beispiel #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");
        }
Beispiel #7
0
 public void UnlockOrderItem(int id)
 {
     BlueTooth.UnlockOrderItem(id);
 }
Beispiel #8
0
 public void LockOrderItem(int id)
 {
     BlueTooth.LockOrderItem(id);
 }
Beispiel #9
0
 public void SendVoidOrder(OrderModel model)
 {
     BlueTooth.DeleteOrder(model);
 }
Beispiel #10
0
 private void bnReboot_Click(object sender, EventArgs e)
 {
     AssertResult(BlueTooth.S10_Reboot());
 }
Beispiel #11
0
 private void bnSetMode_Click(object sender, EventArgs e)
 {
     AssertResult(BlueTooth.S10_SetOperationMode((S10_OperationMode)cbbMode.SelectedIndex));
 }