当前位置:网站首页>Summer Challenge [FFH] harmonyos mobile phone remote control Dayu development board camera
Summer Challenge [FFH] harmonyos mobile phone remote control Dayu development board camera
2022-06-30 23:26:00 【51CTO】
[ This article is participating in the starlight project 3.0- Summer Challenge ]
The previous blog posts solved HarmonyOS and OpenHarmony Communication problems , Now try to do something with communication . For example, remote control the camera of the development board with a mobile phone , Or the camera of the development board remote control mobile phone , And even send back photos . The way to call the board's camera has been studied , There are two main types , One is camera Components , One is to call API. Start with the simple camera Component start .
0. effect
- Interface call successful
- Existing problems
The pictures taken are not actually saved to the gallery .
1.Camera Components
1.1 Need authority
Camera permissions , Permission to read and write media files .
1.2 Supported events
In addition to common events , And support error event , Triggered when the user is not allowed to use the camera .
1.3 Support methods
Support only ,takePhoto(CameraTakePhotoOptions), Photo setting parameters .
- CameraTakePhotoOptions
parameter list
Parameters | type | describe |
---|---|---|
quality | string | Picture quality :high,normal,low |
success | Function | Interface calls the successful callback function |
fail | Function | Interface call failed callback function |
complete | Function | The callback function at the end of the interface call |
2. Case writing
About the mobile phone side , Development board side UDP Please read my previous blog posts for correspondence , Only share here Camera Component invocation of
HarmonyOS And OpenHarmony signal communication
2.1 index.css
Here you can use a camera picture for the overall situation
- flash Value controls the turn on of the flash
- @error That's what I mentioned earlier , Callback function that will be triggered if the user does not authorize
- deviceposition The value of indicates the front and rear cameras ,front Indicates the front ,back Indicates post .
2.2 index.js
It is agreed here that , Accept to 0 The information of indicates the operation of taking pictures , The mobile phone side can be written using the previous functions .
- takePhoto(options)
There will be takpic() Method binding to UDPsocket On the listening function of , When the judgment information is 0 When , Take photos , It can be done by toast The window judges the shooting situation .
- stay config.json Add read-write media to , Camera permissions .
- Get user authorization
3. Conclusion
so Camera The component can obtain the preview and photographing functions of the camera , Each callback function can enter , But it is not saved to the gallery , It may be that the component is not yet complete . Next time we continue to try calling other api To get the camera preview stream and take photos .
Attachment link :
Development board side UDP+Camera Case study .zip( https://ost.51cto.com/resource/2108)
HarmonyOS.zip( https://ost.51cto.com/resource/2109)
Want to know more about open source , Please visit :
边栏推荐
- How to use robots Txt and its detailed explanation
- 图纸加密如何保障我们的核心图纸安全
- MaxPool2d详解--在数组和图像中的应用
- 基金销售行为规范及信息管理
- C# /platform:anycpu32bitpreferred 只能与 /t:exe、/t:winexe 和 /t:appcontainerexe 一起使用
- CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
- Repetition is the mother of skill
- What does the &?
- "Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
- Swift 5.0 - creation and use of swift framework
猜你喜欢
QQmlApplicationEngine failed to load component qrc:/main. qml:-1 No such file or directory
What does the &?
Doker's container data volume
Analysis of 8253a register
Why did kubernetes win? The changes in the container circle!
ESP8266 成为客户端和服务器
Maxpool2d explanation -- Application in arrays and images
76页智慧物流园区综合解决方案2022(附下载)
[无线通信基础-13]:图解移动通信技术与应用发展-1-概述
Esp8266 becomes client and server
随机推荐
Jmeter跨线程参数关联无需脚本
[golang] golang implements the string interception function substr
Shell multitasking to download video at the same time
如何关闭一个开放的DNS解析器
leetcode:104. Maximum depth of binary tree
理想中的接口自动化项目
leetcode 474. Ones and Zeroes 一和零(中等)
Two dots on the top of the latex letter
基金客户服务
35家巨头科技公司联合组成元宇宙标准论坛组织
Cloud games | cloud computing drives the game industry into a "new era"
[fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview
Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
leetcode 474. Ones and zeroes (medium)
异步過渡方案—Generator
Reason why wechat payment wxpaypubhelper V3 callback XML is empty
五分钟搞懂探索式测试
唯一性索引与逻辑删除冲突问题解决思路
CTFSHOW框架复现篇
微信支付WxPayPubHelper v3版 回调xml为空的原因