Compact framework application gets deleted when the battery dies - c#

I am developing an application in C# .Net 3.5 Compact framework for a Handheld Computer which runs on Microsoft Windows CE 6.0.
I am able to create the installer and run the application, the hurdle what I am facing right now is, say the battery dies/you perform a Cold Boot on the device (the device is Datalogic Memor X3 http://www.datalogic.com/eng/products/healthcare/mobile-computers/memor-x3-healthcare-pd-814.html#), the application gets deleted, the user will have to re-install the application. I would like to know how to get rid off this problem? Is there something I need to do while building the Setup/Installer? There are other applications in the device which do not get deleted when performed a Cold boot.
Please advise.

Usually, the root filesystem of a Windows CE devices is RAM-based, using the object store. Mass storage devices are mounted as subfolders. This means that any application that is not installed on a folder connected to a mass-storage device will disappear when RAM contents are erased. In your case this happens when the battery dies because the device never actually turns off, just suspends and resumes.
You should try to install your application on a permanent folder, they should show a different icon in file explorer.

Most if not all vendors of Windows CE based devices offer a persistent storage area and factory reset / autoinstall procedure.
If the device is clean/cold booted, the 'normal' storage area is reset to factory default. So all custom applications and changes are deleted. When the device boots up, there is a OEM specific autoinstall process. You need to integrate your setup with the autoinstall.
Please see the Datalogic Memor X3 support page and look at the user manual on how to persist your application with this Datalogic device (I would have done that for you, but they require a registration).
UPDATE: see https://www.manualslib.com/manual/850035/Datalogic-Memor-X3.html?page=64#manual and read about Save Session and Save Setup.
At least you can use a SD Card with a special folder (ie 2577 for devices with ARM processor) and a custom autorun.exe inside. This will be executed automatically on every boot.

Related

access windows 10 mobile root files and folders

I have a Windows 10 universal app that is running on a Windows 10 Mobile device. I noticed from the Windows 10 Mobile device, it does have a file explorer but it limits you to only see certain "Known Folders" such as music, documents, downloads, etc... and that is all.
Furthermore, when I plug the device into my development machine via USB, I can browse the device but again, only the Known Folders above.
In my app, I am writing to a log file and that log file is stored to LocalStorage, under a folder for my app name, for example:
var dataPath = ApplicationData.Current.LocalFolder.Path;
I simply need to browse MY LOG FILE, that MY APP CREATES, in MY APP FOLDER. I read about a ton of, in my opinion hacks, to get access to this file/folder. For example, there are some third party applications that still mainly claim to target Windows Phone 8/8.1 but will still technically work for 10 such as:
Windows Phone Power Tools
Isolated storage spy
etc....
Then I also read articles on how to use a file in Pictures (or voice recording) and go to file properties to then gain access to the root or to create a root shortcut on the development machine and copy it to the mobile device, however, these are typically a year or more old and no longer work on my device (I suspect MS patched these hacks).
So, all that said, I would like to see a good way to access the root drive for development, or at least my app folder in the LocalFolder so I can access my files (such as logs or the sqlite db file). Maybe there is a way already but my google searches haven't turned anything up just yet.
Thanks!
As you've known, we can use some third party tools like IsoStoreSpy or Windows Phone Power Tools to access Isolated Storage. Although they are designed for Windows Phone 8 & 8.1, but they can also be used for Windows 10 Mobile. With these two tools, we can access LocalFolder, TemporaryFolder and RoamingFolder. For more info, see similar question: Accessing storage of simulator/device while debugging.
Besides these third party tools, there is also build-in support in Windows 10. We can use App File Explorer to view and manipulate files stored by your sideloaded apps. This is a new, cross-platform version of the Isolated Storage Explorer from Windows Phone 8.1. This tool should be able to work no matter your application is deployed in Debug mode or Release mode. But please note that this is a new tool added to Windows Device Portal in the Anniversary Update.
To use this feature, we must enable Device discovery and Device Portal. Then we can access application storage in web browser like following:
For more info, please see Device Portal for Mobile and Using the App File Explorer to see your app data. Also the similar question: Windows 10 Mobile: how can I see inside on my app folder? might be helpful.
I had a similar problem to solve few months back. I ended up doing two things:
I've implemented a 'Send Logs' button in settings that would upload logs to a ftp server. Actually it was a bit more than that, all installations of this app were managed by a central server and there was 'Get logs' button on the server side that would send request via push channel to the device to get the logs.
Got my hands on a Interop-unlocked device that I would use if the app was in a state that would make first option not possible.

Is there a way to detect whether Windows is installing a device driver?

The situation:
We have a software suite that interacts with a device we built in-house. The device uses WinUSB for communications, EXCEPT when in boot mode during firmware updates. When in boot mode, the device uses a different VendorID and ProductID and uses HID for communication.
The problem:
To update firmware, we send a command across and tell the device to enter boot mode. The device re-enumerates with the new VID and PID. When updating firmware on a new machine that hasn't had a device in boot mode connected before, Windows does the "installing driver" dance when the bootloader shows up. (There's no driver to be installed). Software gets a DEVICE ATTACHED event, and so we begin the firmware update. Once Windows finishes "installing" the driver, it de-enumerates and re-enumerates the device, closing our file handle in the middle of the update.
The question:
Is there a way to detect if Windows is installing a driver so that we can wait for the device to be re-enumerated before beginning the update process? Is there something we can do in our install to preempt this behavior? Maybe a way to tell Windows that we don't want to allow driver installation while we're connected to the device?
Maybe a way to tell Windows that we don't want to allow driver installation while we're connected to the device?
Microsoft's Developer Network has a section for Hardware Development. They have an article specifically about this issue. Importantly, the document states that your device installation application should "determine whether other installation activities are in progress before performing its installations" (emphasis mine) and - if pending installations are found - "should exit".
This last part of the statement seems to indicate Microsoft gives precedence to already installing or pending device application installations.
If your problem statement is accurate:
When updating firmware on a new machine that hasn't had a device in boot mode connected before, Windows does the "installing driver" dance when the bootloader shows up.
It sounds like you may be out of luck - or breaking a convention - by attempting to preempt the driver installation behavior.
I would utilize the above mentioned CMP_WaitNoPendingInstallEvents function, and then firmware update your device. I think the VID/PID are irrelevant, here, depending upon where your firmware update code is running. It looks like the OSR Online Forum has a question of the same nature and assumes the same precedence (driver installation).

Windows Phone 8.1 How to permanently remove Roaming Settings?

I've stored some data in the ApplicationData.Current.RoamingSettings following the Example here http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700362.aspx .
The problem is that after storing the data in the RoamingSettings and then removing the same data using ApplicationData.Current.RoamingSettings.Values.Remove(key) (I've checked and actually the data are no more there), if I Uninstall and re-install the App on my Phone the Data I've deleted are back in RoamingSettings...
I've tried also ApplicationData.Current.ClearAsync() that clean all but after uninstalling and re-installing the app same thing.. the data are back.
Any suggestions?
RoamingSettings are designed to work like that. They can be used to store settings between devices. After you uninstall the App from all devices, the settings would persist in the cloud for some time in case the User installs the App again. If you want to use only local data - take a look at LocalSettings.
You will find more information about Guidlines for Roaming Data here at MSDN.
And here at the blog you will find similar answer:
Q. What happens to roaming app data when an app is uninstalled?
A. As noted in the previous question, an app’s app data folders are removed from a device when the app is uninstalled. Roaming app data, however, persists in the cloud so long as the user has the same app installed on other devices. When the user uninstalls the app from all of his or her devices, roaming app data continues to persist in the cloud for a reasonable time (a matter of a few weeks) so that it’s still available if the user decides to reinstall the app within that time. Note that when you make a change to an app project in Microsoft Visual Studio and that change (such as changing the manifest) forces a full reinstall, app data is removed as part of the process. References: Guidelines for roaming app data(overview docs).
So your to remove permanently your RoamingSettings you will have to wait.
EDIT - thanks to Pablo we have more detailed information here at MSDN:
Roaming data for an app is available in the cloud as long as it is accessed by the user from some device within the required time interval. If the user does not run an app for longer than this time interval, its roaming data is removed from the cloud. If a user uninstalls an app, its roaming data isn't automatically removed from the cloud, it's preserved. If the user reinstalls the app within the time interval, the roaming data is synchronized from the cloud. The current policy specifies that this time interval is 30 days.

Resetting Win CE Registry

I was working on a win CE 5.0 device and changed the registry value of Launch50 (which is normally explorer.exe) to point to my application. The Problem is that the path specified in the registry entry is wrong and the device does not boot up properly. I do not have a means of connecting this device to my PC. is there a way to fix the registry entry by booting into a SD card or something of that sort. If there is How do I do this? The Device is a mini Point of sale (Wintec IDT700)
This is tough. Reverting to the factory state is very device specific. First stop is to check with the OEM.
Does the device have a mechanism to auto-run an app at startup from an inserted media or similar? If y\so, creating an app to modify the registry back would be an alternative.

Unable to enable a claimed device using POS for .Net

I am using a Motorola DS4208 hand held barcode reader. In the past I was able to successfully setup and use this device, however recently it has stopped working. This may be the result of installing other devices that also use OPOS and POS for .Net interfaces.
This is a USB device so I created a Control Configuration file named *Moto_Scanner.xml* and placed it in the correct location.
<PointOfServiceConfig Version="1.0">
<ServiceObject Type="Scanner" Name="Example Scanner">
<HardwareId
From="HID\VID_05E0&PID_1300&REV_0100"
To="HID\VID_05E0&PID_1300&REV_0100" />
<HardwareId
From="HID\VID_05E0&PID_1300"
To="HID\VID_05E0&PID_1300" />
</ServiceObject>
</PointOfServiceConfig>
Using SOMgr.exe I can see the device in POSDevices with the proper path. I then created a LogicalName of MotoScan. It then appears in the Logical Names list as expected.
Using Microsoft Point Of Service\SDK\Samples\Sample Application\TestApp.exe I am able to open and claim the device. However, after attempting click the enable checkbox I get the following error message.
POSControlException ErrorCode(Failure) ExtendedErrorCode(0) occurred: Unable to enable the device. See inner exception for details.
System.ComponentModel.Win32Exception: The process cannot access the file because it is being used by another process
at Microsoft.PointOfService.ExampleServiceObjects.HidReader.HidThread.StartReading()
at Microsoft.PointOfService.ExampleServiceObjects.HidReader.OpenDevice()
at Microsoft.PointOfService.ExampleServiceObjects.ExampleScanner.set_DeviceEnabled(Boolean value)
Opened device: Example Scanner
Created instance of device: Example Scanner
Motorola provides an app called 123Scan to assist with configuration and testing. Using this app I can confirm the device works. This app was eventually uninstalled as part of troubleshooting.
Any suggestions will be appreciated.
Have you tried installing the OPOS driver?
EDIT:
Instead of re-linking this every time it expires, you should proactively search for "OPOS Driver" at http://support.symbol.com so that you can download the driver for the appropriate platform.
Through the learning process it became clear that opening and claiming a device does not mean it is actually connected. POS Explorer will allow you to open a connection and claim a device for exclusive use even if it not physically connected. This is partially because POS Explorer is using a Service Object to communicate with the hardware.
It is not until you enable a device, that you will have positive confirmation the device is available. In fact, if enable fails you have confirmation the device is not connected.
The Motorola DS4208 hand held scanner does not require a custom made configuration mapping file. After installing the Motorola ADK the correct Service Objects are installed and they have the Hardware Ids internally stored. In my previous code I attempted to use the "Example Scanner" Service Object available in the POS Explorer SDK to communicate with that hardware, that was my primary mistake.
After the OPOS Driver for Symbol Scanners v3.31 were installed I had not trouble testing the hardware.

Categories