init
16
.browserslistrc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# For the full list of supported browsers by the Angular framework, please see:
|
||||||
|
# https://angular.io/guide/browser-support
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
Chrome >=79
|
||||||
|
ChromeAndroid >=79
|
||||||
|
Firefox >=70
|
||||||
|
Edge >=79
|
||||||
|
Safari >=14
|
||||||
|
iOS >=14
|
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
46
.eslintrc.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"ignorePatterns": ["projects/**/*"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts"],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": ["tsconfig.json"],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:@angular-eslint/recommended",
|
||||||
|
"plugin:@angular-eslint/template/process-inline-templates"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/component-class-suffix": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"suffixes": ["Page", "Component"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "attribute",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "camelCase"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.html"],
|
||||||
|
"extends": ["plugin:@angular-eslint/template/recommended"],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
68
.gitignore
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# Specifies intentionally untracked files to ignore when using Git
|
||||||
|
# http://git-scm.com/docs/gitignore
|
||||||
|
|
||||||
|
*~
|
||||||
|
*.sw[mnpcod]
|
||||||
|
.tmp
|
||||||
|
*.tmp
|
||||||
|
*.tmp.*
|
||||||
|
UserInterfaceState.xcuserstate
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
*.log
|
||||||
|
log.txt
|
||||||
|
|
||||||
|
|
||||||
|
/.sourcemaps
|
||||||
|
/.versions
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# Ionic
|
||||||
|
/.ionic
|
||||||
|
/www
|
||||||
|
/platforms
|
||||||
|
/plugins
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
5
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"ionic.ionic"
|
||||||
|
]
|
||||||
|
}
|
1
README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
优博讯 RFID 插件 https://m.shuto.cn:8681/public/cordova-plugin-ubx-rfid 示例 App
|
179
angular.json
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"app": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "www",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "src/assets",
|
||||||
|
"output": "assets"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"glob": "**/*.svg",
|
||||||
|
"input": "node_modules/ionicons/dist/ionicons/svg",
|
||||||
|
"output": "./svg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/theme/variables.scss",
|
||||||
|
"src/global.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "2mb",
|
||||||
|
"maximumError": "5mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"optimization": false,
|
||||||
|
"vendorChunk": true,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"namedChunks": true
|
||||||
|
},
|
||||||
|
"ci": {
|
||||||
|
"progress": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "app:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "app:build:development"
|
||||||
|
},
|
||||||
|
"ci": {
|
||||||
|
"progress": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "app:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"karmaConfig": "karma.conf.js",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "src/assets",
|
||||||
|
"output": "assets"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"glob": "**/*.svg",
|
||||||
|
"input": "node_modules/ionicons/dist/ionicons/svg",
|
||||||
|
"output": "./svg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/theme/variables.scss",
|
||||||
|
"src/global.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"progress": false,
|
||||||
|
"watch": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-eslint/builder:lint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.html"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ionic-cordova-serve": {
|
||||||
|
"builder": "@ionic/cordova-builders:cordova-serve",
|
||||||
|
"options": {
|
||||||
|
"cordovaBuildTarget": "app:ionic-cordova-build",
|
||||||
|
"devServerTarget": "app:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"cordovaBuildTarget": "app:ionic-cordova-build:production",
|
||||||
|
"devServerTarget": "app:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ionic-cordova-build": {
|
||||||
|
"builder": "@ionic/cordova-builders:cordova-build",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "app:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "app:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cli": {
|
||||||
|
"schematicCollections": [
|
||||||
|
"@ionic/angular-toolkit"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"schematics": {
|
||||||
|
"@ionic/angular-toolkit:component": {
|
||||||
|
"styleext": "scss"
|
||||||
|
},
|
||||||
|
"@ionic/angular-toolkit:page": {
|
||||||
|
"styleext": "scss"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
102
config.xml
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<widget id="cn.shuto.demo.ubxrfid" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||||
|
<name>ubxrfid-demo</name>
|
||||||
|
<description>An awesome Ionic/Cordova app.</description>
|
||||||
|
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
||||||
|
<content src="index.html" />
|
||||||
|
<access origin="*" />
|
||||||
|
<allow-intent href="http://*/*" />
|
||||||
|
<allow-intent href="https://*/*" />
|
||||||
|
<allow-intent href="tel:*" />
|
||||||
|
<allow-intent href="sms:*" />
|
||||||
|
<allow-intent href="mailto:*" />
|
||||||
|
<allow-intent href="geo:*" />
|
||||||
|
<preference name="ScrollEnabled" value="false" />
|
||||||
|
<preference name="BackupWebStorage" value="none" />
|
||||||
|
<preference name="SplashMaintainAspectRatio" value="true" />
|
||||||
|
<preference name="FadeSplashScreenDuration" value="300" />
|
||||||
|
<preference name="SplashShowOnlyFirstTime" value="false" />
|
||||||
|
<preference name="SplashScreen" value="screen" />
|
||||||
|
<preference name="SplashScreenDelay" value="300" />
|
||||||
|
<preference name="AutoHideSplashScreen" value="false" />
|
||||||
|
<platform name="android">
|
||||||
|
<preference name="Scheme" value="http" />
|
||||||
|
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application android:networkSecurityConfig="@xml/network_security_config" />
|
||||||
|
</edit-config>
|
||||||
|
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
|
||||||
|
<allow-intent href="market:*" />
|
||||||
|
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
|
||||||
|
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
|
||||||
|
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
|
||||||
|
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
|
||||||
|
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
|
||||||
|
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
|
||||||
|
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
|
||||||
|
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
|
||||||
|
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
|
||||||
|
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
|
||||||
|
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
|
||||||
|
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
|
||||||
|
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
|
||||||
|
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
|
||||||
|
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
|
||||||
|
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
|
||||||
|
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
|
||||||
|
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
|
||||||
|
</platform>
|
||||||
|
<platform name="ios">
|
||||||
|
<allow-intent href="itms:*" />
|
||||||
|
<allow-intent href="itms-apps:*" />
|
||||||
|
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
|
||||||
|
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
|
||||||
|
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
|
||||||
|
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
|
||||||
|
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
|
||||||
|
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
|
||||||
|
<icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
|
||||||
|
<icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
|
||||||
|
<icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
|
||||||
|
<icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
|
||||||
|
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
|
||||||
|
<icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
|
||||||
|
<icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
|
||||||
|
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
|
||||||
|
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
|
||||||
|
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
|
||||||
|
<icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
|
||||||
|
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
|
||||||
|
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
|
||||||
|
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
|
||||||
|
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
|
||||||
|
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
|
||||||
|
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
|
||||||
|
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
|
||||||
|
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
|
||||||
|
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
|
||||||
|
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
|
||||||
|
<icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
|
||||||
|
<icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
|
||||||
|
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
|
||||||
|
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
|
||||||
|
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
|
||||||
|
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
|
||||||
|
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
|
||||||
|
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
|
||||||
|
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
|
||||||
|
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
|
||||||
|
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
|
||||||
|
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
|
||||||
|
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
|
||||||
|
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
|
||||||
|
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
|
||||||
|
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
|
||||||
|
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
|
||||||
|
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
|
||||||
|
</platform>
|
||||||
|
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
|
||||||
|
<plugin name="cordova-plugin-device" spec="2.0.2" />
|
||||||
|
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
|
||||||
|
<plugin name="cordova-plugin-ionic-webview" spec="^5.0.0" />
|
||||||
|
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
|
||||||
|
</widget>
|
7
ionic.config.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "ubxrfid-demo",
|
||||||
|
"integrations": {
|
||||||
|
"cordova": {}
|
||||||
|
},
|
||||||
|
"type": "angular"
|
||||||
|
}
|
44
karma.conf.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Karma configuration file, see link for more information
|
||||||
|
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
jasmine: {
|
||||||
|
// you can add configuration options for Jasmine here
|
||||||
|
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||||
|
// for example, you can disable the random execution with `random: false`
|
||||||
|
// or set a specific seed with `seed: 4321`
|
||||||
|
},
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
jasmineHtmlReporter: {
|
||||||
|
suppressAll: true // removes the duplicated traces
|
||||||
|
},
|
||||||
|
coverageReporter: {
|
||||||
|
dir: require('path').join(__dirname, './coverage/app'),
|
||||||
|
subdir: '.',
|
||||||
|
reporters: [
|
||||||
|
{ type: 'html' },
|
||||||
|
{ type: 'text-summary' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
27192
package-lock.json
generated
Normal file
83
package.json
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"name": "ubxrfid-demo",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"author": "Ionic Framework",
|
||||||
|
"homepage": "https://ionicframework.com/",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test",
|
||||||
|
"lint": "ng lint"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "^16.0.0",
|
||||||
|
"@angular/common": "^16.0.0",
|
||||||
|
"@angular/compiler": "^16.0.0",
|
||||||
|
"@angular/core": "^16.0.0",
|
||||||
|
"@angular/forms": "^16.0.0",
|
||||||
|
"@angular/platform-browser": "^16.0.0",
|
||||||
|
"@angular/platform-browser-dynamic": "^16.0.0",
|
||||||
|
"@angular/router": "^16.0.0",
|
||||||
|
"@awesome-cordova-plugins/splash-screen": "^6.4.0",
|
||||||
|
"@ionic/angular": "^7.0.0",
|
||||||
|
"@ionic/cordova-builders": "^10.0.0",
|
||||||
|
"ionicons": "^7.0.0",
|
||||||
|
"rxjs": "~7.8.0",
|
||||||
|
"tslib": "^2.3.0",
|
||||||
|
"zone.js": "~0.13.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "^16.0.0",
|
||||||
|
"@angular-eslint/builder": "^16.0.0",
|
||||||
|
"@angular-eslint/eslint-plugin": "^16.0.0",
|
||||||
|
"@angular-eslint/eslint-plugin-template": "^16.0.0",
|
||||||
|
"@angular-eslint/schematics": "^16.0.0",
|
||||||
|
"@angular-eslint/template-parser": "^16.0.0",
|
||||||
|
"@angular/cli": "^16.0.0",
|
||||||
|
"@angular/compiler-cli": "^16.0.0",
|
||||||
|
"@angular/language-service": "^16.0.0",
|
||||||
|
"@ionic/angular-toolkit": "^9.0.0",
|
||||||
|
"@types/jasmine": "~4.3.0",
|
||||||
|
"@types/node": "^12.11.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.3.0",
|
||||||
|
"@typescript-eslint/parser": "5.3.0",
|
||||||
|
"cordova-android": "^10.1.2",
|
||||||
|
"cordova-plugin-device": "2.0.2",
|
||||||
|
"cordova-plugin-ionic-keyboard": "^2.0.5",
|
||||||
|
"cordova-plugin-ionic-webview": "^5.0.0",
|
||||||
|
"cordova-plugin-splashscreen": "5.0.2",
|
||||||
|
"cordova-plugin-statusbar": "^2.4.2",
|
||||||
|
"cordova-plugin-ubx-rfid": "file:../cordova-plugin-ubx-rfid",
|
||||||
|
"eslint": "^7.26.0",
|
||||||
|
"eslint-plugin-import": "2.22.1",
|
||||||
|
"eslint-plugin-jsdoc": "30.7.6",
|
||||||
|
"eslint-plugin-prefer-arrow": "1.2.2",
|
||||||
|
"jasmine-core": "~4.6.0",
|
||||||
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
|
"karma": "~6.4.0",
|
||||||
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
|
"karma-coverage": "~2.2.0",
|
||||||
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
|
"karma-jasmine": "~5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "~2.0.0",
|
||||||
|
"ts-node": "^8.3.0",
|
||||||
|
"typescript": "~5.0.2"
|
||||||
|
},
|
||||||
|
"description": "An Ionic project",
|
||||||
|
"cordova": {
|
||||||
|
"plugins": {
|
||||||
|
"cordova-plugin-statusbar": {},
|
||||||
|
"cordova-plugin-device": {},
|
||||||
|
"cordova-plugin-splashscreen": {},
|
||||||
|
"cordova-plugin-ionic-webview": {},
|
||||||
|
"cordova-plugin-ionic-keyboard": {},
|
||||||
|
"cordova-plugin-ubx-rfid": {}
|
||||||
|
},
|
||||||
|
"platforms": [
|
||||||
|
"android"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
8
resources/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
These are Cordova resources. You can replace icon.png and splash.png and run
|
||||||
|
`ionic cordova resources` to generate custom icons and splash screens for your
|
||||||
|
app. See `ionic cordova resources --help` for details.
|
||||||
|
|
||||||
|
Cordova reference documentation:
|
||||||
|
|
||||||
|
- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html
|
||||||
|
- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
|
BIN
resources/android/icon/drawable-hdpi-icon.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
resources/android/icon/drawable-ldpi-icon.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/android/icon/drawable-mdpi-icon.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/android/icon/drawable-xhdpi-icon.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
resources/android/icon/drawable-xxhdpi-icon.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
resources/android/icon/drawable-xxxhdpi-icon.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
resources/android/splash/drawable-land-hdpi-screen.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
resources/android/splash/drawable-land-ldpi-screen.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
resources/android/splash/drawable-land-mdpi-screen.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
resources/android/splash/drawable-land-xhdpi-screen.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
resources/android/splash/drawable-land-xxhdpi-screen.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
resources/android/splash/drawable-land-xxxhdpi-screen.png
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
resources/android/splash/drawable-port-hdpi-screen.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
resources/android/splash/drawable-port-ldpi-screen.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
resources/android/splash/drawable-port-mdpi-screen.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
resources/android/splash/drawable-port-xhdpi-screen.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
resources/android/splash/drawable-port-xxhdpi-screen.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
resources/android/splash/drawable-port-xxxhdpi-screen.png
Normal file
After Width: | Height: | Size: 110 KiB |
6
resources/android/xml/network_security_config.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config>
|
||||||
|
<domain-config cleartextTrafficPermitted="true">
|
||||||
|
<domain includeSubdomains="true">localhost</domain>
|
||||||
|
</domain-config>
|
||||||
|
</network-security-config>
|
BIN
resources/icon.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
resources/ios/icon/icon-1024.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
resources/ios/icon/icon-20.png
Normal file
After Width: | Height: | Size: 686 B |
BIN
resources/ios/icon/icon-20@2x.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/ios/icon/icon-20@3x.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
resources/ios/icon/icon-24@2x.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/ios/icon/icon-27.5@2x.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
resources/ios/icon/icon-29.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/ios/icon/icon-29@2x.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
resources/ios/icon/icon-29@3x.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
resources/ios/icon/icon-40.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/ios/icon/icon-40@2x.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
resources/ios/icon/icon-40@3x.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
resources/ios/icon/icon-44@2x.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
resources/ios/icon/icon-50.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
resources/ios/icon/icon-50@2x.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
resources/ios/icon/icon-60.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
resources/ios/icon/icon-60@2x.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
resources/ios/icon/icon-60@3x.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
resources/ios/icon/icon-72.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
resources/ios/icon/icon-72@2x.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
resources/ios/icon/icon-76.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
resources/ios/icon/icon-76@2x.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
resources/ios/icon/icon-83.5@2x.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
resources/ios/icon/icon-86@2x.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
resources/ios/icon/icon-98@2x.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
resources/ios/icon/icon-small.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/ios/icon/icon-small@2x.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
resources/ios/icon/icon-small@3x.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
resources/ios/icon/icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/ios/icon/icon@2x.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
resources/ios/splash/Default-2436h.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
resources/ios/splash/Default-568h@2x~iphone.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
resources/ios/splash/Default-667h.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
resources/ios/splash/Default-736h.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
resources/ios/splash/Default-Landscape-2436h.png
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
resources/ios/splash/Default-Landscape-736h.png
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
resources/ios/splash/Default-Landscape@2x~ipad.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
resources/ios/splash/Default-Landscape@~ipadpro.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
resources/ios/splash/Default-Landscape~ipad.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
resources/ios/splash/Default-Portrait@2x~ipad.png
Normal file
After Width: | Height: | Size: 147 KiB |
BIN
resources/ios/splash/Default-Portrait@~ipadpro.png
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
resources/ios/splash/Default-Portrait~ipad.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
resources/ios/splash/Default@2x~iphone.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
resources/ios/splash/Default@2x~universal~anyany.png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
resources/ios/splash/Default~iphone.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
resources/splash.png
Normal file
After Width: | Height: | Size: 77 KiB |
22
src/app/app-routing.module.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'home',
|
||||||
|
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: 'home',
|
||||||
|
pathMatch: 'full'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
|
||||||
|
],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
3
src/app/app.component.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<ion-app>
|
||||||
|
<ion-router-outlet></ion-router-outlet>
|
||||||
|
</ion-app>
|
0
src/app/app.component.scss
Normal file
21
src/app/app.component.spec.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [AppComponent],
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
}).compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
10
src/app/app.component.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
templateUrl: 'app.component.html',
|
||||||
|
styleUrls: ['app.component.scss'],
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
constructor() {}
|
||||||
|
}
|
16
src/app/app.module.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { RouteReuseStrategy } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [AppComponent],
|
||||||
|
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
|
||||||
|
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
|
||||||
|
bootstrap: [AppComponent],
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
16
src/app/home/home-routing.module.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { HomePage } from './home.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: HomePage,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class HomePageRoutingModule {}
|
19
src/app/home/home.module.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { HomePage } from './home.page';
|
||||||
|
|
||||||
|
import { HomePageRoutingModule } from './home-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
HomePageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [HomePage]
|
||||||
|
})
|
||||||
|
export class HomePageModule {}
|
53
src/app/home/home.page.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<ion-header [translucent]="true">
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>
|
||||||
|
UBX RFID
|
||||||
|
</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-content [fullscreen]="true">
|
||||||
|
<ion-header collapse="condense">
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title size="large">UBX RFID</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-list>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>
|
||||||
|
Device:
|
||||||
|
<ion-note class="ion-text-wrap">{{ device | json }}</ion-note>
|
||||||
|
</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-toggle justify="space-between" [checked]="device.beep" (ionChange)="toggleBeep()">响铃</ion-toggle>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>功率:</ion-label>
|
||||||
|
<ion-input [(ngModel)]="device.power"></ion-input>
|
||||||
|
<ion-button (click)="getPower()">Get</ion-button>
|
||||||
|
<ion-button (click)="setPower()">Set</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>扫描间隔:</ion-label>
|
||||||
|
<ion-input [(ngModel)]="device.scanInterval"></ion-input>
|
||||||
|
<ion-button (click)="getScanInterval()">Get</ion-button>
|
||||||
|
<ion-button (click)="setScanInterval()">Set</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-note>{{ device.epc | json }}</ion-note>
|
||||||
|
<ion-button (click)="searchCard()">扫描</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item-divider>Info List</ion-item-divider>
|
||||||
|
<ion-item>
|
||||||
|
<ion-button (click)="toggleScan()">{{ button.title }}</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item *ngFor="let item of epcs">
|
||||||
|
<ion-label>
|
||||||
|
{{ item.epc }}
|
||||||
|
</ion-label>
|
||||||
|
<ion-badge slot="end">{{ item.count }}</ion-badge>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
|
</ion-content>
|
27
src/app/home/home.page.scss
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#container {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
#container strong {
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container p {
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 22px;
|
||||||
|
|
||||||
|
color: #8c8c8c;
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
24
src/app/home/home.page.spec.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { HomePage } from './home.page';
|
||||||
|
|
||||||
|
describe('HomePage', () => {
|
||||||
|
let component: HomePage;
|
||||||
|
let fixture: ComponentFixture<HomePage>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [HomePage],
|
||||||
|
imports: [IonicModule.forRoot()]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(HomePage);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
133
src/app/home/home.page.ts
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Platform } from '@ionic/angular';
|
||||||
|
import { SplashScreen } from "@awesome-cordova-plugins/splash-screen";
|
||||||
|
|
||||||
|
declare var window: any;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-home',
|
||||||
|
templateUrl: 'home.page.html',
|
||||||
|
styleUrls: ['home.page.scss'],
|
||||||
|
})
|
||||||
|
export class HomePage {
|
||||||
|
|
||||||
|
device: any = {};
|
||||||
|
scan: boolean = false;
|
||||||
|
button: any = {
|
||||||
|
title: '开始扫描'
|
||||||
|
};
|
||||||
|
epcs: any[] = [];
|
||||||
|
|
||||||
|
constructor(private platform : Platform) {
|
||||||
|
|
||||||
|
// 接收连续读卡时的数据
|
||||||
|
window.addEventListener('ubxrfid', (info: any) => {
|
||||||
|
console.log('received epc: ', JSON.stringify(info));
|
||||||
|
let exist = false;
|
||||||
|
for (const e of this.epcs) {
|
||||||
|
if (e.epc === info.epc) {
|
||||||
|
exist = true;
|
||||||
|
e.count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!exist) {
|
||||||
|
this.epcs.push({ epc: info.epc, count: 1 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.platform.ready().then(() => {
|
||||||
|
SplashScreen.hide();
|
||||||
|
window.cordova.plugin.ubxRfid.getDeviceInfo().then(
|
||||||
|
(info:any) => {
|
||||||
|
this.device = info;
|
||||||
|
console.log('getDeviceInfo: ', JSON.stringify(this.device));
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
errorInfo(err: string) {
|
||||||
|
alert(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleScan() {
|
||||||
|
if (this.scan) {
|
||||||
|
this.button.title = '开始扫描';
|
||||||
|
this.scan = false;
|
||||||
|
window.cordova.plugin.ubxRfid.stopSearchCard().then( (
|
||||||
|
msg: string) => {
|
||||||
|
console.log('stopSearchCard: ', msg);
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.epcs = [];
|
||||||
|
this.button.title = '停止扫描';
|
||||||
|
this.scan = true;
|
||||||
|
window.cordova.plugin.ubxRfid.startSearchCard().then(
|
||||||
|
this.receiveResult,
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
receiveResult(epc: any) {
|
||||||
|
console.log('epc result: ', JSON.stringify(epc));
|
||||||
|
}
|
||||||
|
|
||||||
|
getPower() {
|
||||||
|
window.cordova.plugin.ubxRfid.getPower().then(
|
||||||
|
(power: any) => {
|
||||||
|
console.log('rfid power: ', power);
|
||||||
|
this.device.power = power;
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setPower() {
|
||||||
|
window.cordova.plugin.ubxRfid.setPower(this.device.power).then(
|
||||||
|
() => {
|
||||||
|
console.log(`set power ${this.device.power} succeess.........`);
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getScanInterval() {
|
||||||
|
window.cordova.plugin.ubxRfid.getScanInterval().then(
|
||||||
|
(scanInterval: any) => {
|
||||||
|
console.log('rfid scanInterval: ', scanInterval);
|
||||||
|
this.device.scanInterval = scanInterval;
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setScanInterval() {
|
||||||
|
window.cordova.plugin.ubxRfid.setScanInterval(this.device.scanInterval).then(
|
||||||
|
() => {
|
||||||
|
console.log(`set scanInterval ${this.device.scanInterval} succeess.........`);
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchCard() {
|
||||||
|
window.cordova.plugin.ubxRfid.searchCard().then(
|
||||||
|
(epc: any) => {
|
||||||
|
console.log('rfid epc result: ', epc);
|
||||||
|
this.device.epc = epc;
|
||||||
|
},
|
||||||
|
this.errorInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleBeep() {
|
||||||
|
this.device.beep = !this.device.beep;
|
||||||
|
window.cordova.plugin.ubxRfid.setBeep(this.device.beep);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
src/assets/icon/favicon.png
Normal file
After Width: | Height: | Size: 930 B |
1
src/assets/shapes.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg width="350" height="140" xmlns="http://www.w3.org/2000/svg" style="background:#f6f7f9"><g fill="none" fill-rule="evenodd"><path fill="#F04141" style="mix-blend-mode:multiply" d="M61.905-34.23l96.194 54.51-66.982 54.512L22 34.887z"/><circle fill="#10DC60" style="mix-blend-mode:multiply" cx="155.5" cy="135.5" r="57.5"/><path fill="#3880FF" style="mix-blend-mode:multiply" d="M208.538 9.513l84.417 15.392L223.93 93.93z"/><path fill="#FFCE00" style="mix-blend-mode:multiply" d="M268.625 106.557l46.332-26.75 46.332 26.75v53.5l-46.332 26.75-46.332-26.75z"/><circle fill="#7044FF" style="mix-blend-mode:multiply" cx="299.5" cy="9.5" r="38.5"/><rect fill="#11D3EA" style="mix-blend-mode:multiply" transform="rotate(-60 148.47 37.886)" x="143.372" y="-7.056" width="10.196" height="89.884" rx="5.098"/><path d="M-25.389 74.253l84.86 8.107c5.498.525 9.53 5.407 9.004 10.905a10 10 0 0 1-.057.477l-12.36 85.671a10.002 10.002 0 0 1-11.634 8.42l-86.351-15.226c-5.44-.959-9.07-6.145-8.112-11.584l13.851-78.551a10 10 0 0 1 10.799-8.219z" fill="#7044FF" style="mix-blend-mode:multiply"/><circle fill="#0CD1E8" style="mix-blend-mode:multiply" cx="273.5" cy="106.5" r="20.5"/></g></svg>
|
After Width: | Height: | Size: 1.1 KiB |
3
src/environments/environment.prod.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true
|
||||||
|
};
|
16
src/environments/environment.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// This file can be replaced during build by using the `fileReplacements` array.
|
||||||
|
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||||
|
// The list of file replacements can be found in `angular.json`.
|
||||||
|
|
||||||
|
export const environment = {
|
||||||
|
production: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For easier debugging in development mode, you can import the following file
|
||||||
|
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||||
|
*
|
||||||
|
* This import should be commented out in production mode because it will have a negative impact
|
||||||
|
* on performance if an error is thrown.
|
||||||
|
*/
|
||||||
|
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
26
src/global.scss
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* App Global CSS
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Put style rules here that you want to apply globally. These styles are for
|
||||||
|
* the entire app and not just one component. Additionally, this file can be
|
||||||
|
* used as an entry point to import other CSS/Sass files to be included in the
|
||||||
|
* output CSS.
|
||||||
|
* For more information on global stylesheets, visit the documentation:
|
||||||
|
* https://ionicframework.com/docs/layout/global-stylesheets
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Core CSS required for Ionic components to work properly */
|
||||||
|
@import "@ionic/angular/css/core.css";
|
||||||
|
|
||||||
|
/* Basic CSS for apps built with Ionic */
|
||||||
|
@import "@ionic/angular/css/normalize.css";
|
||||||
|
@import "@ionic/angular/css/structure.css";
|
||||||
|
@import "@ionic/angular/css/typography.css";
|
||||||
|
@import "@ionic/angular/css/display.css";
|
||||||
|
|
||||||
|
/* Optional CSS utils that can be commented out */
|
||||||
|
@import "@ionic/angular/css/padding.css";
|
||||||
|
@import "@ionic/angular/css/float-elements.css";
|
||||||
|
@import "@ionic/angular/css/text-alignment.css";
|
||||||
|
@import "@ionic/angular/css/text-transformation.css";
|
||||||
|
@import "@ionic/angular/css/flex-utils.css";
|
26
src/index.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Ionic App</title>
|
||||||
|
|
||||||
|
<base href="/" />
|
||||||
|
|
||||||
|
<meta name="color-scheme" content="light dark" />
|
||||||
|
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<meta name="format-detection" content="telephone=no" />
|
||||||
|
<meta name="msapplication-tap-highlight" content="no" />
|
||||||
|
|
||||||
|
<link rel="icon" type="image/png" href="assets/icon/favicon.png" />
|
||||||
|
|
||||||
|
<!-- add to homescreen for ios -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
12
src/main.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { enableProdMode } from '@angular/core';
|
||||||
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
import { AppModule } from './app/app.module';
|
||||||
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
|
if (environment.production) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||||
|
.catch(err => console.log(err));
|
55
src/polyfills.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||||
|
* You can add your own extra polyfills to this file.
|
||||||
|
*
|
||||||
|
* This file is divided into 2 sections:
|
||||||
|
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||||
|
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||||
|
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||||
|
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||||
|
*
|
||||||
|
* Learn more in https://angular.io/guide/browser-support
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* BROWSER POLYFILLS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||||
|
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||||
|
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||||
|
* will put import in the top of bundle, so user need to create a separate file
|
||||||
|
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||||
|
* into that file, and then add the following code before importing zone.js.
|
||||||
|
* import './zone-flags';
|
||||||
|
*
|
||||||
|
* The flags allowed in zone-flags.ts are listed here.
|
||||||
|
*
|
||||||
|
* The following flags will work for all browsers.
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||||
|
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||||
|
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||||
|
*
|
||||||
|
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||||
|
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_enable_cross_context_check = true;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import './zone-flags';
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Zone JS is required by default for Angular itself.
|
||||||
|
*/
|
||||||
|
import 'zone.js'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* APPLICATION IMPORTS
|
||||||
|
*/
|
14
src/test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
|
import 'zone.js/testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting
|
||||||
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
|
// First, initialize the Angular testing environment.
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting(),
|
||||||
|
);
|