I have a chromapp which sends data to PC using usb, connected as an HID device, working perfectly in Linux. While trying to do the same in windows, the app sees that the device is connected but throws an runtime error :
Unchecked runtime.lastError while running hid.receive: Transfer failed.
The hid.receive callback function is implemented as follows
var pollDevice = function() {
var size = 64;
chrome.hid.receive(connectionId, function(reportId, data) {
if (data != null) {
var dataAscii = arrayBufferToString(data);
console.log(dataAscii);
}
setTimeout(pollDevice, 1);
});
};
I am running Google Chrome Version : 52.0.2743.116 on Windows 10 Pro, Version 1607, Build 14388.0
Did someone else similar issues? Can someone help me out on this??
Related
I am developing a chrome app that needs to be connected to a custom HID device.I am able to receive data from the the device.
I do have write permission on hid and usb bus.Yet there is no data received by the device.
I am successfully able to send data via hidapi in a separate program.
Can you suggest any method to check whether or not chrome.hid.send is working or not?
OS : Arch Linux
Chrome version : 46.0.2490.22 beta (64-bit)
Well the following code snippet seems to work for me : (taken from HID sample app from chrome-app-samples)
function sendHid(){
var bytes = new Uint8Array(63);
bytes[0] = 0x01;//to send 0x01 to HID device
chrome.hid.send(connectionId,0,bytes.buffer,function(){
if (chrome.runtime.lastError) {
console.log(chrome.runtime.lastError.message);
return;
}
else {
console.log("Sent!");
}
});
}
A call to the Windows phone 8 bluetooth api is not working in Windows 8. I'm getting the following exception:
System.InvalidOperationException' occurred in sampleunivapp.Windows.exe but was not handled in user code
WinRT information: FindAllPeersAsync cannot be called before Start
Additional information: A method was called at an unexpected time.
code
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = string.Empty;
var peerList =await PeerFinder.FindAllPeersAsync();
if (peerList.Count > 0)
{
wpeername.Text = peerList[0].DisplayName;
}
else
{
var msg=new MessageDialog("No active peers");
msg.ShowAsync();
}
I've written a small .NET Console program that will launch the Windows 8 Simulator. Very straightforward:
using Microsoft.SmartDevice.Connectivity;
using Microsoft.SmartDevice.Connectivity.Interface;
using Microsoft.SmartDevice.MultiTargeting.Connectivity;
MultiTargetingConnectivity connectivity = new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID);
var devices = connectivity.GetConnectableDevices();
ConnectableDevice connectableDevice = devices[2];
Console.WriteLine("Found Connectable Device \'" + connectableDevice.Name + "\' for Device id {" + connectableDevice.Id + "}.");
Pretty straightforward. However, what I want to do now is programmatically interact with the device. I know I can launch my own Apps by using iDevice.installApplication but what I really want to do is run a built-in app that comes with the simulator (the mail app). Can I use the SmartDevice.Connectivity libs to send touches, or launch 'hidden' apps that don't show up in the GetInstalledApplications() method? the API is sparse, and doesn't seem like a ton of developers are using this.
I've actually found a better framework than the SmartDevice framework. Inside the C:\Program Files (x86)\Microsoft XDE\8.0 folder you can find the Microsoft.XDE DLLs, which help power the Windows 8 simulator wrapper/skin, and are managed libraries that allow you to interact with the simulator. Sample code:
private static void BootViaXdeLibs()
{
var factory = new Microsoft.Xde.Wmi.XdeWmiFactory();
Console.WriteLine("Polling for virtual machines");
var virtualMachine = factory.GetAllXdeVirtualMachines(SettingsOptions.None)[2];
Console.WriteLine("Found machine {0}", virtualMachine.Name);
if (virtualMachine.EnabledState != VirtualMachineEnabledState.Disabled)
{
Console.WriteLine("Virtual Machine {0} is already running. Shutting down. ", virtualMachine.Name);
virtualMachine.Stop();
while (virtualMachine.EnabledState != VirtualMachineEnabledState.Disabled)
{
Thread.Sleep(1000);
}
}
Console.WriteLine("Starting {0}", virtualMachine.Name);
virtualMachine.Start();
while (virtualMachine.EnabledState == VirtualMachineEnabledState.Starting)
{
Thread.Sleep(1000);
}
Console.WriteLine("Sleeping before image capture to give boot time");
Thread.Sleep(30000);
//Click on the screen
virtualMachine.SendMouseEvent(new MouseEventArgs(MouseButtons.Left, 1, 295, 260, 0));
Thread.Sleep(100);
virtualMachine.SendMouseEvent(new MouseEventArgs(MouseButtons.None, 0, 295, 260, 0));
Thread.Sleep(1000);
Console.WriteLine("Saving screenshot");
//Capture Screen
var res = virtualMachine.GetCurrentResolution();
var image = virtualMachine.GetScreenShot(0, 0, res.Width, res.Height);
image.Save("C:\\image.png", ImageFormat.Png);
virtualMachine.Stop();
}
Is that possible to make the buy & try options in windows phone 8
like in the windows store apps.
One of my game in the windows store is full access for one week from the day of download. After that windows store itself locks the game(If we give 1 week in the dashboard).
Like that, windows phone 8 having any of the features. .
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286402(v=vs.105).aspx#BKMK_Runningtheapplication
Even i tried for Buy & try using the above link.
I changed the checklicense() like below.
private void CheckLicense()
{
if DEBUG
string message = "This sample demonstrates the implementation of a trial mode in an application." +
"Press 'OK' to simulate trial mode. Press 'Cancel' to run the application in normal mode.";
if (MessageBox.Show(message, "Debug Trial",
MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
_isTrial = true;
}
else
{
_isTrial = false;
}
else
_isTrial = _licenseInfo.IsTrial();
//Included lines
if(_isTrail)
freeversion = true; //Here Free version trigger when user presses Try
else
freeversion = false; //Here fullversion trigger when user presses Buy
//Included lines
endif
}
If i did like this. I run it in the Master Mode. It always goes for freeversion is false.(i.e: _isTrail is always returns false).
Its because of i have not yet uploaded to windows phone store or some other problem??
Help out to solve this??
There is no automated way to do that on Windows Phone, you'll have to implement the trial limitation yourself in the app.
Note that uninstalling an app on Windows Phone leaves no traces. Therefore, users will be able restart the trial period if they uninstall/reinstall the app.
Here is the code that i used:
private void CheckLicense()
{
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
try
{
var listing = await CurrentApp.LoadListingInformationAsync();
var _price = listing.FormattedPrice;
// start product purchase
await CurrentApp.RequestProductPurchaseAsync("FeatureName", false);
ProductLicense productLicense = null;
if (CurrentApp.LicenseInformation.ProductLicenses.TryGetValue("FeatureName", out productLicense))
{
if (productLicense.IsActive)
{
MessageBox.Show("Product purchased");
CurrentApp.ReportProductFulfillment("FeatureName");
ProductPurchased(); // It display product purchased & trigger full version
return;
}
else
{
str = "Purchase failed";
ShowErrorPopup(str); // It shows error msg. purchase failed.
return;
}
}
}
catch (Exception)
{
str = "Purchase failed. Check internet connection and try again";
ShowErrorPopup(str);
return;
}
}
I'm trying to run the "Using IndexedDB" sample code on https://developer.mozilla.org/en-US/docs/IndexedDB/Using_IndexedDB
Right out of the gate I stumble with the first line of code:
window.indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
Using Firebug I see that window.indexedDB is undefined as expected for FF 15, window.webkitIndexedDB is undefined as expected (FF isn't webkit) but window.mozIndexedDB is null but not undefined. If it's null that tells me it exists but doesn't have a valid value/isn't initialized.
This is with Firefox 15.0.1 on OSX 10.6.8 and Ubuntu 12.04. Can somebody tell me why I'm not able to see/use window.mozIndexedDB? Am I doing something wrong?
For completeness, here's my JavaScript file:
window.indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
var request = window.indexedDB.open("MyTestDatabase", 3);
var db;
request.onerror = function (event) {
alert("Oops, request.onerror");
};
request.onsuccess = function (event) {
// Do something with request.result!
alert("Made it to request.onsuccess");
db = request.result;
};
// This event is only implemented in recent browsers
request.onupgradeneeded = function (event) {
alert("Made it to request.onupgradeneeded");
};
db.onerror = function (event) {
alert("Database error (db.onerror): " + event.target.errorCode);
};
My original HTML5 application uses jQuery Mobile & REST WS. In development I would run it directly from the file system and it works fine. For sharing with coworkers I have it running behind Apache httpd.
While adding the IndexedDB, I was trying to test by viewing files from the file system via the browser. It didn't work and that's what caused me to go back to square one and try running the example code from Mozilla.
It appears IndexedDB requires a domain even if it's localhost. I simply placed my code under public_html and viewed it via httpd/localhost and it's working perfectly.