-
Notifications
You must be signed in to change notification settings - Fork 31
Remaining ControlId Methods #62
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
98605d1
add remaining controlId methods
SoZ0 f5005b6
libcamera git is down so manually implemented at the moment
SoZ0 dd3c5d8
wip
SoZ0 2720aa3
fmt and final changes
SoZ0 81ce9b3
clippy
SoZ0 8b71229
clippy for real this time
SoZ0 3e2591e
made id public
SoZ0 c46a429
fix examples
SoZ0 55bb486
incorrect method name
SoZ0 399eb18
controltype
SoZ0 6d782e7
clippy my number one opp
SoZ0 eda40d3
Merge remote-tracking branch 'upstream/main' into control-id-methods
SoZ0 2cdfca6
clippy
SoZ0 65344c4
more clippy
SoZ0 5f54987
clippy good now?
SoZ0 cd24ec2
Merge remote-tracking branch 'upstream/main' into control-id-methods
SoZ0 3a08e45
need to fixup props generate
SoZ0 720b3ce
Merge remote-tracking branch 'upstream/main' into control-id-methods
SoZ0 850a603
Moved out side gen code
SoZ0 5d43e04
unused imports removed
SoZ0 a7fe7a1
stray unused removed
SoZ0 dff7553
gen files missed commit
SoZ0 55e94d8
review changes
SoZ0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| use libcamera::{camera_manager::CameraManager, controls::ControlId, logging::LoggingLevel}; | ||
|
|
||
| fn main() { | ||
| let mgr = CameraManager::new().unwrap(); | ||
|
|
||
| mgr.log_set_level("Camera", LoggingLevel::Error); | ||
|
|
||
| let cameras = mgr.cameras(); | ||
|
|
||
| for cam in cameras.iter() { | ||
| println!("ID: {}", cam.id()); | ||
|
|
||
| for (id, _) in cam.controls() { | ||
| let id = ControlId::from_id(id).unwrap(); | ||
| println!("{:#?}", id.name()); | ||
| println!(" Vendor: {:#?}", id.vendor()); | ||
| println!(" Control Type: {:#?}", id.control_type()); | ||
| println!(" Size: {:#?}", id.size()); | ||
| println!(" Direction: {:#?}", id.direction()); | ||
| println!(" Is Array: {:#?}", id.is_array()); | ||
| println!(" Is Input: {:#?}", id.is_input()); | ||
| println!(" Is Output: {:#?}", id.is_output()); | ||
| println!(" Enumarators: {:?}", id.enumerators_map()); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this would work better as an iterator, see ControlListRefIterator implementation to iterate a C++ map. Current implementation will cost
O(2n log n)to collect everything into hashmap, becausestd::advance(it, index)isO(log n)for C++ map, which is called for each entry twice. I know that this is not a performance critical path, but I would like it to be consistent inside the repo. A separate convenience function can just.collect()rust iterator into aHashMap<i32, String>.