473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Passing parameters between adapter triggered methods

I am working on a Xamarin.Forms app, to connect to a bluetooth device and then to select a known service the device is broadcasting. I am using the Monkey.Robotics plugin, which contains an adaptor. That triggers certain Async events, such as DeviceConnected, once this happens I then want to be able to reference the device id variable, so that I can scan for the services. How do I get the device variable from the NewDeviceButton.Clicked code, to the DeviceConnected code? Bear in mind that I would rather not modify the adapter, as it comes with the component, and I would rather not miss out on future updates.
Expand|Select|Wrap|Line Numbers
  1. namespace Gas_Sense
  2. {
  3.     public partial class HomePage : ContentPage
  4.     {
  5.  
  6.         IAdapter adapter;
  7.         {
  8.             InitializeComponent ();
  9.             this.adapter = adapter;
  10.             this.devices = new ObservableCollection<IDevice>();
  11.  
  12.             NewDeviceButton.Clicked += async (sender, e) => {
  13.  
  14.                 adapter.StartScanningForDevices (0x180D.UuidFromPartial ()); 
  15.                  //rest of the choose correct device code
  16.  
  17.                     adapter.ConnectToDevice (device); 
  18.                 }
  19.             };
  20.  
  21.             adapter.DeviceConnected += (s, e) => {
  22.  
  23.                 device.DiscoverServices ();
  24.  
  25.             };
  26.  
  27.         }
  28.     }
  29. }
  30.  
Thanks very much.
Sep 22 '15 #1
0 1211

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
2
by: Akira | last post by:
Hello. I'm having problem with passing parameters from .aspx file to user control. Could anyone tell me how to pass parameters from .aspx file to user control(.ascx) and how to recieve parameters...
0
by: Paul Allan | last post by:
I am new to ASP.net (intermediate ASP developer). I am developing a ASP.net web application and I am having some difficulty calling and passing parameters to a function that is declared in my...
4
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and...
4
by: David Freeman | last post by:
Hi There! I'm just wondering if there's a way to pass parameters (as if you were passing parameters to a ASCX web control) when calling an ASPX page? e.g. MyDetailsPage.UserName = "david" ...
2
by: Nab | last post by:
I have just tried to pass parameters to a procedure in VB 2005 and realised that you only need to pass the input parameter. The output parameter's value will be returned without the need to pass it...
1
by: Gert Wurzer | last post by:
Hi! I have an asp.net 2.0 web application that uses an iframe to access another asp.bet 2.0 webapp via https. I've already found a working prototype solution to create a dynamic iframe taking...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.