当前位置:网站首页>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 :
边栏推荐
- DNS server setup, forwarding, master-slave configuration
- lvm-snapshot:基于LVM快照的备份
- [golang] golang implements the string interception function substr
- 让企业数字化砸锅和IT主管背锅的软件供应链安全风险指北
- 机器学习编译入门课程学习笔记第二讲 张量程序抽象
- 智慧路灯| 云计算点亮智慧城市的“星星之火”
- 35 giant technology companies jointly form the meta universe standard Forum Organization
- MaxPool2d详解--在数组和图像中的应用
- As the public cloud market enters the deep water, can the calm Amazon cloud still sit still?
- C language array interception, C string by array interception method (c/s)
猜你喜欢

Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.

Redis' cache penetration, cache breakdown and cache avalanche

What is SRM system and how to standardize the internal procurement process of the company
![CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构](/img/ce/519778cd731f814ad111d1e37abd10.png)
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构

女朋友说:你要搞懂了MySQL三大日志,我就让你嘿嘿嘿!

MaxPool2d详解--在数组和图像中的应用

Software supply chain security risk pointing North for enterprise digitalization and it executives

QQmlApplicationEngine failed to load component qrc:/main. qml:-1 No such file or directory
![[无线通信基础-13]:图解移动通信技术与应用发展-1-概述](/img/1d/62e55f1b5445d7349ec383879f4275.png)
[无线通信基础-13]:图解移动通信技术与应用发展-1-概述

What does project management really manage?
随机推荐
需求评审,测试人员应该发挥怎样的价值?两分钟让你不再懵逼
在线客服系统代码_h5客服_对接公众号_支持APP_支持多语言
d编译时计数
图纸加密如何保障我们的核心图纸安全
Red Hat将在Project Atomic上运用容器负载服务器
Advanced mathematical modeling
Jmeter跨线程参数关联无需脚本
5G智慧建筑解决方案2021
智慧路灯| 云计算点亮智慧城市的“星星之火”
[leetcode] [SQL] notes
Fund managers' corporate governance and risk management
[无线通信基础-13]:图解移动通信技术与应用发展-1-概述
What does the &?
Maxpool2d explanation -- Application in arrays and images
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
MIT博士论文 | 优化理论与机器学习实践
Esp8266 becomes client and server
E-commerce seckill system
Ride: get picture Base64
ESP8266 成为客户端和服务器