/*
 * Copyright 2016 The Android Open Source Project
 *
 * 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.
 */

package android.hardware.wifi@1.0;

/**
 * NAN Response and Asynchronous Event Callbacks.
 *
 * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness
 * Networking (NAN) Technical Specification".
 */
interface IWifiNanIfaceEventCallback {
  /**
   * Notify callbacks are asynchronous callbacks - but in response to |IWifiNanIface| method calls.
   * Each method will receive a notify callback to return results (on success) or failure status.
   */

  /**
   * Asynchronous callback invoked in response to a capability request
   * |IWifiNanIface.getCapabilitiesRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   * @param capabilities Capability data.
   */
  oneway notifyCapabilitiesResponse(CommandIdShort id, WifiNanStatus status,
                                    NanCapabilities capabilities);

  /**
   * Asynchronous callback invoked in response to an enable request |IWifiNanIface.enableRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.ALREADY_ENABLED|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.NAN_NOT_ALLOWED|
   */
  oneway notifyEnableResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a config request |IWifiNanIface.configRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.PROTOCOL_FAILURE|
   */
  oneway notifyConfigResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a disable request |IWifiNanIface.disableRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.PROTOCOL_FAILURE|
   */
  oneway notifyDisableResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked to notify the status of the start publish request
   * |IWifiNanIface.startPublishRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
   *        |NanStatusType.INVALID_SESSION_ID|
   * @param sessionId ID of the new publish session (if successfully created).
   */
  oneway notifyStartPublishResponse(CommandIdShort id, WifiNanStatus status, uint8_t sessionId);

  /**
   * Asynchronous callback invoked in response to a stop publish request
   * |IWifiNanIface.stopPublishRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_SESSION_ID|
   *        |NanStatusType.INTERNAL_FAILURE|
   */
  oneway notifyStopPublishResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked to notify the status of the start subscribe request
   * |IWifiNanIface.startSubscribeRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
   *        |NanStatusType.INVALID_SESSION_ID|
   * @param sessionId ID of the new subscribe session (if successfully created).
   */
  oneway notifyStartSubscribeResponse(CommandIdShort id, WifiNanStatus status, uint8_t sessionId);

  /**
   * Asynchronous callback invoked in response to a stop subscribe request
   * |IWifiNanIface.stopSubscribeRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_SESSION_ID|
   *        |NanStatusType.INTERNAL_FAILURE|
   */
  oneway notifyStopSubscribeResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a transmit followup request
   * |IWifiNanIface.transmitFollowupRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.INVALID_SESSION_ID|
   *        |NanStatusType.INVALID_PEER_ID|
   *        |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
   */
  oneway notifyTransmitFollowupResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a create data interface request
   * |IWifiNanIface.createDataInterfaceRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   */
  oneway notifyCreateDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a delete data interface request
   * |IWifiNanIface.deleteDataInterfaceRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   */
  oneway notifyDeleteDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to an initiate data path request
   * |IWifiNanIface.initiateDataPathRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.INVALID_PEER_ID|
   * @param ndpInstanceId ID of the new data path being negotiated (on successful status).
   */
  oneway notifyInitiateDataPathResponse(CommandIdShort id, WifiNanStatus status,
        uint32_t ndpInstanceId );

  /**
   * Asynchronous callback invoked in response to a respond to data path indication request
   * |IWifiNanIface.respondToDataPathIndicationRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.INVALID_NDP_ID|
   */
  oneway notifyRespondToDataPathIndicationResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback invoked in response to a terminate data path request
   * |IWifiNanIface.terminateDataPathRequest|.
   *
   * @param cmdId command Id corresponding to the original request.
   * @param status WifiNanStatus of the operation. Possible status codes are:
   *        |NanStatusType.SUCCESS|
   *        |NanStatusType.INVALID_ARGS|
   *        |NanStatusType.INTERNAL_FAILURE|
   *        |NanStatusType.PROTOCOL_FAILURE|
   *        |NanStatusType.INVALID_NDP_ID|
   */
  oneway notifyTerminateDataPathResponse(CommandIdShort id, WifiNanStatus status);

  /**
   * Callbacks for the various asynchornous NAN Events.
   */

  /**
   * Asynchronous callback indicating that a cluster event has been received.
   *
   * @param event: NanClusterEventInd containing event details.
   */
  oneway eventClusterEvent(NanClusterEventInd event);

  /**
   * Asynchronous callback indicating that a NAN has been disabled.
   *
   * @param status: WifiNanStatus describing the reason for the disable event.
   *                Possible status codes are:
   *                |NanStatusType.SUCCESS|
   *                |NanStatusType.UNSUPPORTED_CONCURRENCY_NAN_DISABLED|
   */
  oneway eventDisabled(WifiNanStatus status);

  /**
   * Asynchronous callback indicating that an active publish session has terminated.
   *
   * @param sessionId: The discovery session ID of the terminated session.
   * @param status: WifiNanStatus describing the reason for the session termination.
   *                Possible status codes are:
   *                |NanStatusType.SUCCESS|
   */
  oneway eventPublishTerminated(uint8_t sessionId, WifiNanStatus status);

  /**
   * Asynchronous callback indicating that an active subscribe session has terminated.
   *
   * @param sessionId: The discovery session ID of the terminated session.
   * @param status: WifiNanStatus describing the reason for the session termination.
   *                 Possible status codes are:
   *                |NanStatusType.SUCCESS|
   */
  oneway eventSubscribeTerminated(uint8_t sessionId, WifiNanStatus status);

  /**
   * Asynchronous callback indicating that a match has occurred: i.e. a service has been
   * discovered.
   *
   * @param event: NanMatchInd containing event details.
   */
  oneway eventMatch(NanMatchInd event);

  /**
   * Asynchronous callback indicating that a previously discovered match (service) has expired.
   *
   * @param discoverySessionId: The discovery session ID of the expired match.
   * @param peerId: The peer ID of the expired match.
   */
  oneway eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId);

  /**
   * Asynchronous callback indicating that a followup message has been received from a peer.
   *
   * @param event: NanFollowupReceivedInd containing event details.
   */
  oneway eventFollowupReceived(NanFollowupReceivedInd event);

  /**
   * Asynchronous callback providing status on a completed followup message transmit operation.
   *
   * @param cmdId command Id corresponding to the original |transmitFollowupRequest| request.
   * @param status WifiNanStatus of the operation.  Possible status codes are:
   *               |NanStatusType.SUCCESS|
   *               |NanStatusType.NO_OTA_ACK|
   *               |NanStatusType.PROTOCOL_FAILURE|
   */
  oneway eventTransmitFollowup(CommandIdShort id, WifiNanStatus status);

  /**
   * Asynchronous callback indicating a data-path (NDP) setup has been requested by an Initiator
   * peer (received by the intended Respodner).
   *
   * @param event: NanDataPathRequestInd containing event details.
   */
  oneway eventDataPathRequest(NanDataPathRequestInd event);

  /**
   * Asynchronous callback indicating a data-path (NDP) setup has been completed: received by
   * both Initiator and Responder.
   *
   * @param event: NanDataPathConfirmInd containing event details.
   */
  oneway eventDataPathConfirm(NanDataPathConfirmInd event);

  /**
   * Asynchronous callback indicating a list of data-paths (NDP) have been terminated: received by
   * both Initiator and Responder.
   *
   * @param ndpInstanceId: data-path ID of the terminated data-path.
   */
  oneway eventDataPathTerminated(uint32_t ndpInstanceId);
};