In my project I am using thread to search via bluetooth devices.But when it searchs some times it crashs and appears ble screan.I couldent read all because it restarts computer but I saw that it is abour some ram blocks. X8001 something like this.Is thread couse this?Or I am also using database Mysql.When it searchs it also gets value from database.
C# cannot cause BSODs. Bluetooth device drivers certainly do, there are a lot of crummy ones out there. Screw up spell checkers too. Post to superuser.com to get help finding updates or better BT stacks.
BSOD should be diagnosed easily with crash dump analysis. Then you can know who breaks the system, and how to move on.
Well, if you cannot DIY, you can consider open a support case via http://support.microsoft.com and involve Microsoft support team.
Related
I considered cross posting to the Super User site or similar but don't know how. As you will see this is not just a programming question.
I developed some C# code to communicate with an Onset InTemp thermometer via Bluetooth Low Energy (BLE). It works fine for a long time. I'm able to get beacons (which have the thermometer data) and also connect, get services and characteristics in case I need to get missed data or set parameters on the thermometer. However, after about 8 hours (can be as much as 24 hours) of continuously receiving beacons and connecting, getting historical data, etc., my app hangs on this line:
var gatt = await device.GetGattServicesAsync();
I put lines before and after this line and verified it's clearly hanging on this line. Again, it can be after 8 hours or 24 hours of use. It certainly chugs along just fine for quite a time. Killing and restarting the program is of no help. It hangs on the first call to:
device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
Only rebooting the PC fixes the problem. This is not surprising given the messages in the Windows Event Logs before it hangs:
The Bluetooth driver expected an HCI event with a certain size but did not receive it.
It's for this reason that I stated that this might be a SuperUser board question. No matter how badly I programmed my code :), killing the program should get BLE working again. FWIW, I did try disabling/re-enabling BLE through settings before rebooting.
I have found some links to this problem, but nothing very definitive.
I'm also working on writing a smaller, complete program to show the problem. So far, I can't get example program to fail from which I conclude that either (1) I haven't let it run long enough, or (2) I'm not fully duplicating what is going on with my full program. Perhaps I'm not putting as much pressure on the BLE drivers or I'm not listening for beacons and attempting to connect in the same ratios or with the same timing.
I should say that I see a lot of gripes about Windows implementation of the BLE Host layer and BLE drivers. Unfortunately, I'm stuck with Windows. Nordic also suggested that everything I'm reporting is a "known problem" and using their Nordic dongle will solve the problem. See for example: https://devzone.nordicsemi.com/f/nordic-q-a/65516/using-nrf52840-dongle-as-receiver-client-for-onset-thermometer.
That may well be true, but it would be a lot of work as they have libraries in C++ and Node.JS but not C#.
Any help is greatly appreciated.
Thank you!
With many new devices such as the Vaio Duo, Vaio Flip, XPS 12, Lenovo Yoga, etc., which are all ultrabook/tablet convertibles, how can I detect which form factor its currently operating in? I know that the Vaio Duo switches performance modes depending on whether its being used as a laptop or as a tablet, so there should be some way, whether it be through pinvoke or something else.
In Windows, to directly check if your system is in tablet (or "slate") mode or not, you can call GetSystemMetrics(SM_CONVERTIBLESLATEMODE). For a discussion of a sample app that does this, check out https://software.intel.com/en-us/articles/how-to-write-a-2-in-1aware-application.
As well as checking on startup, you should be able to get a WM_SETTINGCHANGE message if the mode changes, which will have "ConvertibleSlateMode" as its LPARAM. In some cases, though, we've seen this message lost. So, it's a good idea to have a manual way to force a mode change in your app anyway.
Shouldnt your program work the same for all form factors, so there for it wouldnt matter which form factor there in.
Also have a look at this if you do need to access that sensor then this may help you.
http://archive.msdn.microsoft.com/WindowsAPICodePack/Release/ProjectReleases.aspx?ReleaseId=4906
This will get you all of your sensors.
Microsoft.WindowsAPICodePack.Sensors.SensorManager.GetAllSensors();
I've been working on this today. So I decided create a wrapper cause I haven't found one. I focused on universal portable class library (because of dispatcher used in monitor) but I can port to...
Here is:
https://github.com/daemun/DeviceExtCapabilitiesUniversal
Found a lot of information on this here: http://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guide
The Problem:
I'm writing an application that needs to receive electrical input from a machine every time the machine does something.
I have a Limit switch set up to the machine and it currently completes a circuit every time the machine does it's thing
I need it to input into a computer using usb as oppose to just complete a circuit.
I had a dataq 'dl-148u-sp' And i got the c# code to produce a graph using ActiveX controls but all i really need is the digital output from the circuit being completed (which for the life of me i couldn't figure out how to do)..
I ended up frying the device(i think) even the software it came with doesn't recognize it anymore...
I need a new device, and it turns out they discontinued the one i had, and the next one up after shipping is like 90$.
The Question:
Is there a Better/Cheaper/Easier way of doing this? Or can anyone suggest a Good device that's easy to get the output using c# code so i can incorporate it into a program i made?
It's not clear if you are asking for a hardware or software solution here. Are you asking what the best way to facilitate that data transfer from your machine to the PC? If so, this may not be the place to ask, but you might look at a USB to GPIO module.
http://numato.com/8-channel-usb-gpio-module is an example.
I'd recommend an Arduino:
http://www.arduino.cc/playground/Main/InterfacingWithHardware
They dev kits are cheap and there's a ton of open/free libraries that interface the Arduino to C#.
More expensive and complex board is IOFirebug with c# library and many functions. Input voltage range is from 5V to 30V.
How to prevent terminal (Windows-CE) from shut-down after 5 minutes
the terminal is Motorola MC3190 (Windows-CE) and if i dont touch the screen for 5 minutes
the terminal shut-down. how to prevent this ?
i need the solution in C# code.
thanks in advance
I initially voted to close, but have been thinking more about this, and I think the question you've asked may have been missing an important piece of information.
I think what you need to look at are the Windows CE Power Management functions, specifically SetPowerRequirement. This allows you to indicate that your application is using some device within the system. If not, it's unclear why your application, absent some device interactions, wants to prevent power management from doing its job.
No code needed for this. Go to Start->Settings->Power and uncheck the box next to "Turn off screen if device not used for".
If you tried to do this programmatically, you would be draining the battery power faster than the user intends. That will probably irritate your user.
If your heart is set on doing this, then you can modify the value in [HKLM]\System\CurrentControlSet\Control\Power\Timeouts
I also gave this answer on the MSDN forums
-PaulH
I dont know Windows-CE and i Dont know C#, but I found you an answer on google. Here you go. And now I want to try programing something for some station. Would be great home control device.
Is your Motorola MC3190 configured to Turn Off if it is running on Battery Power? Will it ever turn off if on External Power?
NOTE: I had to post as answer to show image, but this isn't really an answer.
EDIT: If this is what you are interested in, consider reading the device's SystemState property. There are many members to SystemState, and one of them just may be what you are after.
There is no easy technique for what you are wanting to do, because the devices are designed to power down when not in use. If the battery goes dead, the devices have to be completely reset. Make sure this is what you want to do, because there is a reason it is hard to get around.
You'll likely have to register for a BatteryStrength changed event (like >> THIS <<), then try to trick it somehow ...maybe by popping up a dialog box or simulating a key press.
You'll most likely need to P/Invoke some of the lower level coredll.dll functionality (examples >> HERE <<) to get what you want, as this stuff doesn't come wrapped up in the standard WinMobile SDK.
EDIT 2: Here's a Great example that someone wrote to read and control as much of the Power State as possible: techlicity blog I liked it so much I've copied the code to a class in my Mobile Project!
We are developing a platform with Windows CE 5 (soon to be upgraded to 6) in .Net CF 2 C#.
What we have recently discovered is that if we are touching the touchscreen while using our peripheral, the peripheral data trafic times out and our application crashes. So it seems like the touchscreen is blocking it. As a quick fix we would like to disable the touchscreen while using the peripheral, and the reenabling it.
So our question is, how do we do it?
Do we need some extra packages in the OS build or can we do it manually. We have had a look at touchpaneldisable() and touchpanelenable(...). But the enable method requires a handle to the callback function. So I have no idea on how to fix this.
From an application perspective tehre really isn't a fix. Touchpanel ddrivers a re alittle different than otehrs becasue they get loaded by (and into) GWES, rather than device.exe. They are not designed to be disabled and enabled, though some OEMs do provide the capability (typically by just masking the touch panel interrupt).
It sounds like the touchpanel sampling rate is really high and the device is saturating the processor when it startes sampling. It's something that the OEM probably needs to fix. Some OEMs do provide registry entries to adjust the driver behavior, so check with them to see if this might be available to you. In that case you may be able to fix the issue yourself.
If you have the BSP you might want to go through this blog post as it suggest possible bottle necks for the touch driver.