mirror of
https://gitee.com/openharmony/applications_settings
synced 2024-11-23 06:20:01 +00:00
1.add notes
Signed-off-by: 15952050689 <lifz0125@thundersoft.com>
This commit is contained in:
parent
c0b87d78bc
commit
791b4afb03
@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.settings",
|
||||
"bundleName": "com.ohos.settings4",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
@ -9,9 +9,9 @@
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.settings",
|
||||
"package": "com.ohos.settings4",
|
||||
"name": ".MyApplication",
|
||||
"mainAbility": "com.ohos.settings.MainAbility",
|
||||
"mainAbility": "com.ohos.settings4.MainAbility",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
@ -34,7 +34,7 @@
|
||||
}
|
||||
],
|
||||
"visible": true,
|
||||
"name": "com.ohos.settings.MainAbility",
|
||||
"name": "com.ohos.settings4.MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:entry_MainAbility",
|
||||
|
@ -41,12 +41,6 @@ export class ConfigData {
|
||||
|
||||
value_20 = 20;
|
||||
font_20 = 20;
|
||||
ONE_HUNDRED_PERCENT = '100%';
|
||||
THIRTY_PERCENT = '30%';
|
||||
FORTY_PERCENT = '40%';
|
||||
FIFTY_PERCENT = '50%';
|
||||
FORTY_FIVE_PERCENT = '45%';
|
||||
FIFTY_FIVE_PERCENT = '55%';
|
||||
|
||||
MAX_LINES_1 = 1;
|
||||
MAX_LINES_2 = 2;
|
||||
|
@ -12,6 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Secure table
|
||||
*/
|
||||
export default {
|
||||
tableName: {
|
||||
Global: "Global"
|
||||
|
@ -12,6 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Secure table
|
||||
*/
|
||||
export default {
|
||||
tableName: {
|
||||
Secure: " Secure"
|
||||
|
@ -12,6 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* System table
|
||||
*/
|
||||
export default {
|
||||
tableName: {
|
||||
System: "System"
|
||||
|
@ -22,12 +22,19 @@ import deviceInfo from '@ohos.deviceInfo';
|
||||
* about device service class
|
||||
*/
|
||||
export class AboutDeviceModel extends BaseModel {
|
||||
|
||||
/**
|
||||
* Get phone information
|
||||
*/
|
||||
setOnAboutDeviceListener(): any {
|
||||
LogUtil.info('settings setOnAboutDeviceListener in');
|
||||
LogUtil.info('settings setOnAboutDeviceListener deviceInfo ' + JSON.stringify(deviceInfo));
|
||||
return deviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* read local file
|
||||
*/
|
||||
public getAboutDeviceInfoListener(): any[] {
|
||||
LogUtil.info('settings getAboutDeviceInfoListener come in');
|
||||
return BaseParseConfModel.getJsonData(ConfigData.FILE_URI.concat('aboutDevice.json'));
|
||||
|
@ -17,7 +17,9 @@ import BaseParseConfModel from '../baseParseConfImpl/BaseParseConfModel.ets';
|
||||
import ConfigData from '../../common/baseUtil/ConfigData.ets';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.ets';
|
||||
import SystemTime from '@ohos.systemTime';
|
||||
|
||||
/**
|
||||
* Set date and time
|
||||
*/
|
||||
export class DateAndTimeModel extends BaseModel {
|
||||
setTime(time) {
|
||||
LogUtil.info('DateAndTimeModel setTime in :' + time);
|
||||
|
@ -22,28 +22,38 @@ export class WifiModel extends BaseModel {
|
||||
private mWifiList: any[] = [];
|
||||
private remdupWifiList: any[] = [];
|
||||
private linkedInfoList: any[] = [];
|
||||
|
||||
/**
|
||||
* Get WiFi switch status
|
||||
*/
|
||||
getWifiStatus() {
|
||||
LogUtil.info('WifiNativeJs isWifiActive');
|
||||
return WifiNativeJs.isWifiActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* WiFi enable
|
||||
*/
|
||||
getEnableWifi() {
|
||||
LogUtil.info('WifiNativeJs enableWifi');
|
||||
return WifiNativeJs.enableWifi();
|
||||
}
|
||||
|
||||
/**
|
||||
* WiFi disable
|
||||
*/
|
||||
disableWifi() {
|
||||
this.linkedInfoList = [];
|
||||
LogUtil.info('WifiNativeJs disableWifi');
|
||||
return WifiNativeJs.disableWifi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan WiFi
|
||||
*/
|
||||
getScanWifi() {
|
||||
LogUtil.info('WifiNativeJs scan');
|
||||
return WifiNativeJs.scan();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WiFi scan information
|
||||
*/
|
||||
getScanInfoCallBack() {
|
||||
LogUtil.info('get to wifi info start');
|
||||
this.mWifiList = [];
|
||||
@ -171,7 +181,11 @@ export class WifiModel extends BaseModel {
|
||||
});
|
||||
LogUtil.info('get to wifi information end ---->');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the subscript of the specified WiFi
|
||||
* @param list
|
||||
* @param ssid
|
||||
*/
|
||||
getItemPosition(list, ssid) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (ssid === list[i].settingTitle) {
|
||||
@ -180,17 +194,24 @@ export class WifiModel extends BaseModel {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connecting equipment
|
||||
* @param obj
|
||||
*/
|
||||
connectToDevice(obj) {
|
||||
LogUtil.info('[wifi_js_test] connect to wifi');
|
||||
return WifiNativeJs.connectToDevice(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect wifi
|
||||
*/
|
||||
disConnect() {
|
||||
LogUtil.info('netWork disconnect');
|
||||
return WifiNativeJs.disConnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connected WiFi information
|
||||
*/
|
||||
getLinkedInfo() {
|
||||
this.linkedInfoList = [];
|
||||
LogUtil.info('[wifi_js] get wifi linked info start');
|
||||
|
@ -13,8 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import HeadComponent from './component/headComponent.ets';
|
||||
import EntryComponent from './component/entryComponent.ets';
|
||||
import AboutDeviceModel from '../model/dateAndTimeImpl/DateAndTimeModel.ets'
|
||||
import ConfigData from '../common/baseUtil/ConfigData.ets';
|
||||
import DateAndTime from '../common/baseUtil/DateAndTimeUtil.ets';
|
||||
import DateAndTimeModel from '../model/dateAndTimeImpl/DateAndTimeModel.ets'
|
||||
@ -92,11 +90,15 @@ struct dateAndTime {
|
||||
.align(Alignment.TopStart);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Successfully built Dialog
|
||||
*/
|
||||
onAccept() {
|
||||
console.log("onAccept");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel Dialog
|
||||
*/
|
||||
existApp() {
|
||||
console.log("Cancel dialog!");
|
||||
}
|
||||
@ -126,7 +128,7 @@ struct dateAndTime {
|
||||
}
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.dateAndTimeList = AboutDeviceModel.dateAndTimeListener();
|
||||
this.dateAndTimeList = DateAndTimeModel.dateAndTimeListener();
|
||||
this.image = this.dateAndTimeList[0].settingArrow;
|
||||
this.time = DateAndTime.getSystemTime();
|
||||
this.date = DateAndTime.getSystemDate();
|
||||
|
@ -31,7 +31,7 @@ const SETTING_LIST_INDEX = 0;
|
||||
const PAGE_WIFI = 'pages/wifi';
|
||||
|
||||
/**
|
||||
* Set home page
|
||||
* setting home page
|
||||
*/
|
||||
@Entry
|
||||
@Component
|
||||
|
@ -162,7 +162,9 @@ struct Index {
|
||||
LogUtil.info('init wifi isOn is false');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect WiFi
|
||||
*/
|
||||
connectWifi() {
|
||||
LogUtil.info('[wifi_js_test] connect to wifi come in');
|
||||
let index = WifiModel.getItemPosition(this.wifiList, this.connectName);
|
||||
@ -199,7 +201,9 @@ struct Index {
|
||||
}
|
||||
LogUtil.info('clickToSecret end:');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get switch status
|
||||
*/
|
||||
getSwitchStatus() {
|
||||
if (WifiModel.getWifiStatus()) {
|
||||
this.isOn = true;
|
||||
@ -207,14 +211,19 @@ struct Index {
|
||||
this.isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delay time
|
||||
* @param delay
|
||||
*/
|
||||
private sleep(delay) {
|
||||
let start = (new Date()).getTime();
|
||||
while ((new Date()).getTime() - start < delay) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The switch is on
|
||||
*/
|
||||
private switchOn() {
|
||||
LogUtil.info('switchClick wifi start ---->');
|
||||
if(this.wifiList.length > 0){
|
||||
@ -245,7 +254,9 @@ struct Index {
|
||||
LogUtil.info('switchClick wifi fail to enableWifi ---->');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The switch is off
|
||||
*/
|
||||
private switchOff() {
|
||||
LogUtil.info('switchClick wifi off start ---->');
|
||||
if (WifiModel.disableWifi()) {
|
||||
@ -257,7 +268,9 @@ struct Index {
|
||||
LogUtil.info('switchClick wifi off end ---->');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WiFi status monitoring
|
||||
*/
|
||||
wifiStatusListener() {
|
||||
LogUtil.info('wifi status listener');
|
||||
Subscriber.createSubscriber(this.mCommonEventSubscribeInfo,
|
||||
@ -325,13 +338,17 @@ struct Index {
|
||||
this.wifiList.splice(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel WiFi status listening
|
||||
*/
|
||||
unSubscriberListener() {
|
||||
Subscriber.unsubscribe(this.mCommonEventSubscriber, () => {
|
||||
LogUtil.info('wifi unsubscribe');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear scan information
|
||||
*/
|
||||
clearScanInfo() {
|
||||
LogUtil.info('clear scan wifiList start---->');
|
||||
this.wifiList = [];
|
||||
|
Loading…
Reference in New Issue
Block a user