From 1dc3116dbbfdad5742e3e1bbc377312c648520fa Mon Sep 17 00:00:00 2001 From: clevercong Date: Tue, 8 Mar 2022 14:53:56 +0800 Subject: [PATCH] sync telephony and net api from master. Signed-off-by: clevercong --- api/@ohos.net.http.d.ts | 2 +- api/@ohos.net.socket.d.ts | 26 +++--- api/@ohos.net.webSocket.d.ts | 126 ++++++++++++++++++++++++++++++ api/@ohos.telephony.call.d.ts | 68 +++++++++------- api/@ohos.telephony.data.d.ts | 26 +++--- api/@ohos.telephony.observer.d.ts | 8 +- api/@ohos.telephony.radio.d.ts | 36 ++++----- api/@ohos.telephony.sim.d.ts | 26 +++--- api/@ohos.telephony.sms.d.ts | 26 +++--- 9 files changed, 240 insertions(+), 104 deletions(-) create mode 100644 api/@ohos.net.webSocket.d.ts diff --git a/api/@ohos.net.http.d.ts b/api/@ohos.net.http.d.ts index de5a6c3ec8..b6ecab57c1 100644 --- a/api/@ohos.net.http.d.ts +++ b/api/@ohos.net.http.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/api/@ohos.net.socket.d.ts b/api/@ohos.net.socket.d.ts index ccabf9041a..fb88669e14 100644 --- a/api/@ohos.net.socket.d.ts +++ b/api/@ohos.net.socket.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback, Callback, ErrorCallback} from "./basic"; import connection from "./@ohos.net.connection"; diff --git a/api/@ohos.net.webSocket.d.ts b/api/@ohos.net.webSocket.d.ts new file mode 100644 index 0000000000..cbb967bee4 --- /dev/null +++ b/api/@ohos.net.webSocket.d.ts @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AsyncCallback, ErrorCallback} from "./basic"; + +/** + * Provides WebSocket APIs. + * + * @since 6 + * @syscap SystemCapability.Communication.NetStack + */ +declare namespace webSocket { + /** + * Creates a web socket connection. + */ + function createWebSocket(): WebSocket; + + export interface WebSocketRequestOptions { + /** + * HTTP request header. + */ + header?: Object; + } + + export interface WebSocketCloseOptions { + /** + * Error code. + */ + code?: number; + /** + * Error cause. + */ + reason?: string; + } + + export interface WebSocket { + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * + * @param url URL for establishing a WebSocket connection. + * @param options Optional parameters {@link WebSocketRequestOptions}. + * @param callback Returns callback used to return the execution result. + * @permission ohos.permission.INTERNET + */ + connect(url: string, callback: AsyncCallback): void; + connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void; + connect(url: string, options?: WebSocketRequestOptions): Promise; + + /** + * Sends data through a WebSocket connection. + * + * @param data Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @param callback Returns callback used to return the execution result. + * @permission ohos.permission.INTERNET + */ + send(data: string | ArrayBuffer, callback: AsyncCallback): void; + send(data: string | ArrayBuffer): Promise; + + /** + * Closes a WebSocket connection. + * + * @param options Optional parameters {@link WebSocketCloseOptions}. + * @param callback Returns callback used to return the execution result. + * @permission ohos.permission.INTERNET + */ + close(callback: AsyncCallback): void; + close(options: WebSocketCloseOptions, callback: AsyncCallback): void; + close(options?: WebSocketCloseOptions): Promise; + + /** + * Enables listening for the open events of a WebSocket connection. + */ + on(type: 'open', callback: AsyncCallback): void; + + /** + * Cancels listening for the open events of a WebSocket connection. + */ + off(type: 'open', callback?: AsyncCallback): void; + + /** + * Enables listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + */ + on(type: 'message', callback: AsyncCallback): void; + + /** + * Cancels listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + */ + off(type: 'message', callback?: AsyncCallback): void; + + /** + * Enables listening for the close events of a WebSocket connection. + */ + on(type: 'close', callback: AsyncCallback<{ code: number, reason: string }>): void; + + /** + * Cancels listening for the close events of a WebSocket connection. + */ + off(type: 'close', callback?: AsyncCallback<{ code: number, reason: string }>): void; + + /** + * Enables listening for the error events of a WebSocket connection. + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Cancels listening for the error events of a WebSocket connection. + */ + off(type: 'error', callback?: ErrorCallback): void; + } +} + +export default webSocket; \ No newline at end of file diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts index 7b5a03dd61..96816be1f7 100644 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback, Callback} from "./basic"; @@ -38,6 +38,16 @@ declare namespace call { function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; function dial(phoneNumber: string, options?: DialOptions): Promise; + /** + * Go to the dial screen and the called number is displayed. + * + * @param phoneNumber Indicates the called number. + * @syscap SystemCapability.Applications.Contacts + * @since 7 + */ + function makeCall(phoneNumber: string, callback: AsyncCallback): void; + function makeCall(phoneNumber: string): Promise; + /** * Checks whether a call is ongoing. * @@ -414,9 +424,9 @@ declare namespace call { * @since 8 */ export interface CallTransferInfo { - transferNum: string, - type: CallTransferType, - settingType: CallTransferSettingType + transferNum: string; + type: CallTransferType; + settingType: CallTransferSettingType; } /** @@ -446,16 +456,16 @@ declare namespace call { * @since 7 */ export interface CallAttributeOptions { - accountNumber: string, - speakerphoneOn: boolean, - accountId: number, - videoState: VideoStateType, - startTime: number, - isEcc: boolean, - callType: CallType, - callId: number, - callState: DetailedCallState, - conferenceState: ConferenceState, + accountNumber: string; + speakerphoneOn: boolean; + accountId: number; + videoState: VideoStateType; + startTime: number; + isEcc: boolean; + callType: CallType; + callId: number; + callState: DetailedCallState; + conferenceState: ConferenceState; } /** @@ -510,9 +520,9 @@ declare namespace call { * @since 8 */ export interface CallRestrictionInfo { - type: CallRestrictionType, - password: string - mode: CallRestrictionMode + type: CallRestrictionType; + password: string; + mode: CallRestrictionMode; } /** diff --git a/api/@ohos.telephony.data.d.ts b/api/@ohos.telephony.data.d.ts index 24a6fa7556..d32d033a35 100644 --- a/api/@ohos.telephony.data.d.ts +++ b/api/@ohos.telephony.data.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback} from "./basic"; diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index e7d6294044..8193aca055 100644 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -162,12 +162,12 @@ declare namespace observer { * @since 7 */ export interface SimStateData { - type: CardType, - state: SimState, + type: CardType; + state: SimState; /** * @since 8 */ - reason: LockReason + reason: LockReason; } /** diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index 38b942aba0..c7486d60a3 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback} from "./basic"; @@ -641,11 +641,11 @@ declare namespace radio { * @since 8 */ export interface CdmaCellInformation { - baseId: number, - latitude: number, - longitude: number, - nid: number, - sid: number, + baseId: number; + latitude: number; + longitude: number; + nid: number; + sid: number; } /** diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts index 83d8ed9902..3b3eac8443 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback} from "./basic"; diff --git a/api/@ohos.telephony.sms.d.ts b/api/@ohos.telephony.sms.d.ts index 5b8e4b45e2..d674251555 100644 --- a/api/@ohos.telephony.sms.d.ts +++ b/api/@ohos.telephony.sms.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import {AsyncCallback} from "./basic"; -- Gitee