I want to use Java script function to open ,read and write the computer's serial port and usb port.
how can I to do this ?
Those functions are not blocked.only take a little time.
I want the functions to return values to JS
I hava read the page :https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage
and https://bitbucket.org/chromiumembedded/ ... gration.md
I find two ways ,one way is PPAPI Plugin ,Is it the correct way to do this ?
another way is "Functions and Window Binding ",
In the render process ,implemente the function to open ,read and write the computer's serial port and usb port
by
- Code: Select all
class MyV8Handler : public CefV8Handler {
public:
MyV8Handler() {}
virtual bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) OVERRIDE {
if (name == "myfunc") {
// Return my string value.
retval = CefV8Value::CreateString("My Value!");
return true;
}
// Function does not exist.
return false;
}
// Provide the reference counting implementation for this class.
IMPLEMENT_REFCOUNTING(MyV8Handler);
};
Is this way correct ? please give me some suggestions or example code and demo code