| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| entry/ | 12-May-2024 | - | 1,504 | 1,315 | ||
| screenshots/devices/ | 12-May-2024 | - | ||||
| .gitignore | D | 12-May-2024 | 121 | 8 | 8 | |
| README.md | D | 12-May-2024 | 1.3 KiB | 23 | 14 | |
| README_zh.md | D | 12-May-2024 | 2.4 KiB | 56 | 28 | |
| build-profile.json5 | D | 12-May-2024 | 1 KiB | 43 | 41 | |
| hvigorfile.js | D | 12-May-2024 | 174 | 2 | 1 | |
| package.json | D | 12-May-2024 | 402 | 20 | 19 |
README.md
1# Distributed Calculator 2 3### Introduction 4 5This sample implements a simple calculator app using JS distributed features. The calculator can perform simple numerical calculations and start a remote calculator Feature Ability \(FA\) to perform collaborative calculation. 6 7- Remote startup: **StartAbility** is used to start a remote app. 8- Collaborative calculation: The **DistributedDataKit** distributed data framework is used to implement data synchronization between remote applications. 9 10### Usage 11 12- Touch the icon on the desktop to start the calculator. 13- Touch the button in the upper right corner of the app, or swipe up, down, left, or right on the screen to display the device selection box. 14- In the device selection box, touch the name of a peer device to start the remote app. 15- After the remote app is started, perform operations on the app at either end. Data can be synchronized between the two apps in real time. 16- In the device selection box, touch the local device to close the remote app. 17 18### Constraints 19 20- This calculator implements only simple addition, subtraction, multiplication, and division operations. You can implement more complex arithmetic operations on the **calc** page based on the current framework. 21- Distributed computing can be implemented only with distributed networking. 22 23
README_zh.md
1# 分布式计算器 2 3### 简介 4 5本示例使用JS分布式能力实现了一个简单的计算器应用,可以进行简单的数值计算,支持远程拉起另一个计算器FA,两个FA进行协同计算。 6 7远程拉起:通过StartAbility实现远端应用的拉起。 8 9协同计算:通过DistributedDataKit分布式数据框架实现异端应用的数据同步。实现效果如下: 10 11 12 13### 相关概念 14 15数据管理实例: 用于获取KVStore的相关信息。 16 17单版本分布式数据库:继承自KVStore,不对数据所属设备进行区分,提供查询数据和同步数据的方法。 18 19### 相关权限 20 21允许不同设备间的数据交换:ohos.permission.DISTRIBUTED_DATASYNC 22 23### 使用说明 24 251.点击桌面应用图标,启动应用。 26 272.点击应用右上角按钮,即可弹出设备选择框。 28 293.在设备选择框中点击对端设备名称,拉起对端应用。 30 314.对端应用启动后,可在任意一端中操作应用,两端应用可实现数据实时同步。 32 335.在设备选择框中选中本机即可关闭对端应用。 34 35### 约束与限制 36 371.本示例只实现简单的加减乘除功能,后续开发者可基于当前框架考虑在calc页面中实现更多的功能,如开方、立方、三角函数等科学计算功能。 38 392.本示例在编译前需安装三方mathjs库,具体安装步骤见[npm](https://gitee.com/openharmony/app_samples/blob/master/EngineeringCapability/Npm/README_zh.md)。 40 413.分布式计算功能使用的前提是分布式组网。 42 434.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。 44 455.本示例需要使用@ohos.distributedHardware.deviceManager系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md/)。 46 476.如果安装本示例报错为error:install sign info inconsistent,则有可能本应用被设置为系统预置应用,已安装在系统中,此时需使用命令进行替换安装,并在替换安装后对设备进行重启操作,具体命令如下: 48 49hdc shell mount -o rw,remount / 50 51hdc file send ./entry-default-signed.hap /system/app/com.example.distributedcalc/Calc_Demo.hap 52 53hdc shell reboot 54 55等设备重启后即可完成应用的替换安装,无需其他操作。 56