-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample Code #14
Comments
Hey, I'll see what I can do. Though, I am not sure it will help you that much. |
Hi,
I am struggling to setup the data source.
As an example, I want to add three capabilities: SupportedCaps, IXResolution and IYResolution. How should I do this:
// is this correct ? how should it be done properly ??
std::map<CapType,Capability*> caps;
caps[CapType::SupportedCaps] = &Capability::createArray<CapType::SupportedCaps>(3);
caps[CapType::SupportedCaps]->array<CapType::SupportedCaps>().at(0) = CapType::SupportedCaps;
caps[CapType::SupportedCaps]->array<CapType::SupportedCaps>().at(1) = CapType::IXResolution;
caps[CapType::SupportedCaps]->array<CapType::SupportedCaps>().at(2) = CapType::IXResolution;
caps[CapType::IXResolution] = &Capability::createEnumeration<CapType::IXResolution>(1);
caps[CapType::IXResolution]->enumeration<CapType::IXResolution>().at(0) = 640;
caps[CapType::IYResolution] = &Capability::createEnumeration<CapType::IXResolution>(1);
caps[CapType::IYResolution]->enumeration<CapType::IXResolution>().at(0) = 480;
Also, in the capbilityGet method: how should I return the caps ?
virtual Result capabilityGet(const Identity& origin, Capability& data) override{
// capability Msg::Get operation
if (caps.find(data.type()) != caps.end())
{
logmsg << "found" << std::endl;
// how should I fill in the data ??
return success();
}
else
{
logmsg << "unsupported" << std::endl;
return capUnsupported();
}
return success();
}
-
|
Hi, I have not forgotten about that sample code I promised you earlier, I hope to put something together next week. About you question. I would not recommend to use these structures to hold your actual data, use them only to pass information within the
In your example, you create a temporary object with
This will not work. A new object is created in the If you truly need a container to hold Capability cap = Capability::createArray<CapType::SupportedCaps>({CapType::SupportedCaps, CapType::IXResolution, CapType::IXResolution});
std::map<CapType, Capability> caps;
caps.emplace(std::make_pair(CapType::SupportedCaps, std::move(cap))) This creates a Have a look at helper methods in To return a |
Added a sample source in d7bae8b |
Hi, For the "Inspector TWAIN" I get an SeqError when the app tries to close the DS when a transfer is started. Do you have tried this before ? |
Issue with Twister TWAIN Analyser seems to be due to the app passing uninitialized handle to the DS, thus resulting in an attempt to free invalid memory. |
Hi, would it be possible to add some sample projects for macos/Windows ? I would like to create a DS for a webcam...
The text was updated successfully, but these errors were encountered: