-
Notifications
You must be signed in to change notification settings - Fork 7
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
Update extending.md #30
base: master
Are you sure you want to change the base?
Conversation
Add details on plugins for camera device
en/guide/extending.md
Outdated
@@ -15,39 +15,35 @@ Video Streaming | Developers can implement new types of video streaming (e.g. HL | |||
|
|||
## Support Custom Camera Device | |||
|
|||
In order to support a new type of camera a custom class must be derived from `CameraDevice`. In addition, code must be added to detect the new device type and to instantiate the new custom camera device when this happens. The sections below detail these steps. | |||
Developers may want to add support for a new type of camera device that is not currently supported by DCM. To support a custom type of camera, a `PluginXXX` class derived from `PluginBase` and `CameraDeviceXXX` class derived from `CameraDevice` must be implemented. An example of a plugin for a custom camera device with classes `PluginCustom`(https://github.com/Dronecode/camera-manger/tree/master/plugins) and `CameraDeviceCustom`(https://github.com/Dronecode/camera-manger/tree/master/plugins) is added in the project and may be referenced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source code links below don't work (I get 404 so possibly secured).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed Typo. Need to be replaced by this - https://github.com/Dronecode/camera-manager/tree/master/plugins/CustomCamera
|
||
### 1. Extend CameraDevice Class | ||
### 1. Extend PluginBase Class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless this must be done in order, don't have titles numbered.
To add support for new type of camera device in DCM, a custom class must be derived from `CameraDevice`. | ||
An example `CameraDeviceCustom` (in green) can be seen in the [class diagram](../guide/architecture.md#class_diagram). | ||
The class `CameraDeviceCustom` represents a custom type of camera device. | ||
Plugins are self-registering objects that discovers, enlists and creates camera devices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that discover, list and, ...
The class `CameraDeviceCustom` represents a custom type of camera device. | ||
Plugins are self-registering objects that discovers, enlists and creates camera devices. | ||
|
||
**Action**: `PluginCustom` must implement the pure virtual functions of the base class `PluginBase`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need to have these "Action" headings. It might also be worth having the functions that must be implemented listed here.
int setParam(CameraParameters &camParam, std::string param, const char *param_value, | ||
size_t value_size, int param_type); | ||
``` | ||
There are few methods in `CameraDevice` class that are not pure virtual. By default it returns `NOT_SUPPORTED`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default they return NOT_SUPPORTED
.
|
||
**Action**: `CameraDeviceCustom` may overload other methods to provide the functionality. | ||
**Action**: `CameraDeviceCustom` may overload not-pure virtual methods to provide the functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can't it overload any methods it likes ? Both pure and impure?
|
||
**Action**: `CameraDeviceCustom` may overload other methods to provide the functionality. | ||
**Action**: `CameraDeviceCustom` may overload not-pure virtual methods to provide the functionality. | ||
|
||
The configurable parameters of the custom camera device can be exported to the client (GCS) for control. Setting of these parameters and resetting of all the parameters must be handled by the `CameraDeviceCustom` class. | ||
|
||
**Action*: `CameraDeviceCustom` must declare the parameter name (string), ID (int) and type (enum). Also set the default value of the parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, not sure that we really need the "Action" headings. But if you want to keep them, this one has a missing asterisk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe something like
CameraDeviceCustom
may declare the parameters that are relevant to the camera type. Each parameter has a name (string), ID (int), type (enum) and default value.
What about the case where a camera can have unique parameters? ie it implements some generic API, but might have additional parameters that aren't part of the API itself (ie that might be set by camera config file).
I guess what I'm saying is what parameters get set here, and which get set in a camera definition file?
} else if (camdev_name.find("camera/custom") != std::string::npos) { | ||
return std::make_shared<CameraDeviceCustom>(camdev_name); | ||
``` | ||
The `CameraServer` will query the `PluginManager` for the list of camera devices that are detected. `CameraServer` will create the `CameraDevice` if the device is not in the blacklist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe link to blacklist docs?
@lbegani Looks like a good start, but links to custom plugin don't work, so not sure how much can be inferred from source. I'd be tempted to list the methods that need to be overloaded - we were going to document these in source right? |
@hamishwillee I will fix the comments soon. I have documented the public APIs in the sources - https://github.com/Dronecode/camera-manager/blob/master/src/PluginBase.h |
OK, probably if you link to the base classes that doc will help people understand what is going on! Great. |
@lbegani I have created some experimental API ref here.
|
fc20582
to
3af8220
Compare
Add details on plugins for camera device