Hi, Tomasz
Thanks a lot for your great support on Tizen WiFi P2P CAPI proposal, and I 
think we have achieved an agreement on the CAPI proposal design in general. And 
we have updated/optimized the CAPI proposal according to our discussion result. 
Review it(the attachment) please, any suggestions, feel free to bring them out, 
thanks in advance!


Regards,
Zhang Zhengguang

> -----Original Message-----
> From: Bursztyka, Tomasz
> Sent: Tuesday, July 22, 2014 5:28 PM
> To: Zhang, Zhengguang; [email protected]
> Cc: [email protected]; C S BHARGAVA; [email protected];
> Laperie, Andrei; Patrik Flykt; Le Foll, Dominique; Liu, Bingwei; Zhu, Peter 
> J; Xu,
> Martin; Yin, Yan; [email protected];
> [email protected]
> Subject: Re: New CAPI Proposal for ConnMan based WiFi P2P Solution
> 
> Hi,
> 
> > Besides, since the WiFi Display related operations will all go through
> ConnMan, when will you release the related interfaces so that we can begin to
> enable WiFi Display feature on tizen as early as possible?
> 
> Not sure yet, since I first have to fix wpa_supplicant itself to be able to
> implement our Peer Service API in ConnMan.
> But that should come in August for sure.
> 
> Tomasz
/* Data structure */
typedef enum {
        WIFI_DIRECT_ERROR_NONE = 0,  /**< Successful */
        WIFI_DIRECT_ERROR_NOT_PERMITTED = -EPERM,  /** Operation not 
permitted(1) */
        WIFI_DIRECT_ERROR_OUT_OF_MEMORY = -ENOMEM,  /** Out of memory(12) */
        WIFI_DIRECT_ERROR_RESOURCE_BUSY = -EBUSY,  /** Device or resource 
busy(16) */
        WIFI_DIRECT_ERROR_INVALID_PARAMETER = -EINVAL,  /** Invalid function 
parameter(22) */
        WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT = -ETIMEDOUT,  /**< Connection 
timed out(110) */
        WIFI_DIRECT_ERROR_NOT_INITIALIZED = -0x00008000|0x0201,  /**< Not 
initialized */
        WIFI_DIRECT_ERROR_COMMUNICATION_FAILED = -0x00008000|0x0202,  /**< I/O 
error */
        WIFI_DIRECT_ERROR_WIFI_USED = -0x00008000|0x0203,  /**< WiFi is being 
used */
        WIFI_DIRECT_ERROR_MOBILE_AP_USED = -0x00008000|0x0204,  /**< Mobile AP 
is being used */
        WIFI_DIRECT_ERROR_CONNECTION_FAILED = -0x00008000|0x0205,  /**< 
Connection failed */
        WIFI_DIRECT_ERROR_OPERATION_FAILED = -0x00008000|0x0207,  /**< 
Operation failed */
} wifi_direct_error_e;

typedef enum {
        WIFI_DIRECT_STATE_DEACTIVATED,
        WIFI_DIRECT_STATE_ACTIVATED,
        WIFI_DIRECT_STATE_CONNECTED,
} wifi_direct_state_e;

typedef enum {
        WIFI_DIRECT_PEER_IDLE,
        WIFI_DIRECT_PEER_CONNECTING,
        WIFI_DIRECT_PEER_CONNECTED,
        WIFI_DIRECT_PEER_DISCONNECTING,
        WIFI_DIRECT_PEER_DISCONNECTED,
} wifi_direct_peer_state_e;

typedef enum {
        WIFI_DIRECT_CATEGORY_COMPUTER_PC,
        WIFI_DIRECT_CATEGORY_COMPUTER_SERVER,
        WIFI_DIRECT_CATEGORY_COMPUTER_MEDIA_CTR,
        WIFI_DIRECT_CATEGORY_COMPUTER_UMPC,
        WIFI_DIRECT_CATEGORY_COMPUTER_NOTEBOOK,
        WIFI_DIRECT_CATEGORY_COMPUTER_DESKTOP,
        WIFI_DIRECT_CATEGORY_COMPUTER_MID,
        WIFI_DIRECT_CATEGORY_COMPUTER_NETBOOK,

        WIFI_DIRECT_CATEGORY_INPUT_KEYBOARD,
        WIFI_DIRECT_CATEGORY_INPUT_MOUSE,
        WIFI_DIRECT_CATEGORY_INPUT_JOYSTICK,
        WIFI_DIRECT_CATEGORY_INPUT_TRACKBALL,
        WIFI_DIRECT_CATEGORY_INPUT_CONTROLLER,
        WIFI_DIRECT_CATEGORY_INPUT_REMOTE,
        WIFI_DIRECT_CATEGORY_INPUT_TOUCHSCREEN,
        WIFI_DIRECT_CATEGORY_INPUT_BIO_READER,
        WIFI_DIRECT_CATEGORY_INPUT_BAR_READER,

        WIFI_DIRECT_CATEGORY_PRINTER_PRINTER,
        WIFI_DIRECT_CATEGORY_PRINTER_SCANNER,
        WIFI_DIRECT_CATEGORY_PRINTER_FAX,
        WIFI_DIRECT_CATEGORY_PRINTER_COPIER,
        WIFI_DIRECT_CATEGORY_PRINTER_ALLINONE,

        WIFI_DIRECT_CATEGORY_CAMERA_DIGITAL_STILL,
        WIFI_DIRECT_CATEGORY_CAMERA_VIDEO,
        WIFI_DIRECT_CATEGORY_CAMERA_WEBCAM,
        WIFI_DIRECT_CATEGORY_CAMERA_SECONDARYURITY,

        WIFI_DIRECT_CATEGORY_STORAGE_NAS,

        WIFI_DIRECT_CATEGORY_NETWORK_INFRA_AP,
        WIFI_DIRECT_CATEGORY_NETWORK_INFRA_ROUTER,
        WIFI_DIRECT_CATEGORY_NETWORK_INFRA_SWITCH,
        WIFI_DIRECT_CATEGORY_NETWORK_INFRA_GATEWAY,

        WIFI_DIRECT_CATEGORY_DISPLAY_TV,
        WIFI_DIRECT_CATEGORY_DISPLAY_PIC_FRAME,
        WIFI_DIRECT_CATEGORY_DISPLAY_PROJECTOR,
        WIFI_DIRECT_CATEGORY_DISPLAY_MONITOR,

        WIFI_DIRECT_CATEGORY_MULTIMEDIA_DAR,
        WIFI_DIRECT_CATEGORY_MULTIMEDIA_PVR,
        WIFI_DIRECT_CATEGORY_MULTIMEDIA_MCX,
        WIFI_DIRECT_CATEGORY_MULTIMEDIA_STB,
        WIFI_DIRECT_CATEGORY_MULTIMEDIA_MSMAME,
        WIFI_DIRECT_CATEGORY_MULTIMEDIA_PVP,

        WIFI_DIRECT_CATEGORY_GAME_XBOX,
        WIFI_DIRECT_CATEGORY_GAME_XBOX_360,
        WIFI_DIRECT_CATEGORY_GAME_PS,
        WIFI_DIRECT_CATEGORY_GAME_CONSOLE,
        WIFI_DIRECT_CATEGORY_GAME_PORTABLE,

        WIFI_DIRECT_CATEGORY_PHONE_WM,
        WIFI_DIRECT_CATEGORY_PHONE_SINGLE,
        WIFI_DIRECT_CATEGORY_PHONE_DUAL,
        WIFI_DIRECT_CATEGORY_PHONE_SM_SINGLE,
        WIFI_DIRECT_CATEGORY_PHONE_SM_DUAL,

        WIFI_DIRECT_CATEGORY_AUDIO_TUNER,
        WIFI_DIRECT_CATEGORY_AUDIO_SPEAKER,
        WIFI_DIRECT_CATEGORY_AUDIO_PMP,
        WIFI_DIRECT_CATEGORY_AUDIO_HEADSET,
        WIFI_DIRECT_CATEGORY_AUDIO_HEADPHONE,
        WIFI_DIRECT_CATEGORY_AUDIO_MIC,
} wifi_direct_category_e;

typedef enum {
        WIFI_DIRECT_WPS_TYPE_NONE = 0x00, /**< No WPS type */
        WIFI_DIRECT_WPS_TYPE_PBC = 0x01,  /**< Push Button */
        WIFI_DIRECT_WPS_TYPE_PIN = 0x02,  /**< PIN code */
        WIFI_DIRECT_WPS_TYPE_BOTH = 0x03, /**< Both PBC and PIN */
} wifi_direct_wps_type_e;

typedef enum {
        WIFI_DIRECT_SERVICE_ALL,
        WIFI_DIRECT_SERVICE_BONJOUR,
        WIFI_DIRECT_SERVICE_UPNP,
        WIFI_DIRECT_SERVICE_WSDISCOVERY,
        WIFI_DIRECT_SERVICE_WIFIDISPLAY,
        WIFI_DIRECT_SERVICE_VENDORSPEC = 0xff,
} wifi_direct_service_type_e;

typedef enum {
        WIFI_DIRECT_DISPLAY_SOURCE,
        WIFI_DIRECT_DISPLAY_PRIMARY_SINK,
        WIFI_DIRECT_DISPLAY_SECONDARY_SINK,
        WIFI_DIRECT_DISPLAY_DUAL_ROLE,
} wifi_direct_display_type_e;

typedef enum {
        WIFI_DIRECT_PBC_ACCEPT,
        WIFI_DIRECT_PBC_REJECT,
} wifi_direct_incoming_connection_handler_e;

typedef struct {
        char *identify:
        char *name;
        char *ip_addr;
        char *netmask;
        wifi_direct_category_e category;
        wifi_direct_peer_state_e state;
} wifi_direct_peer_info_s;

/* Inteface */

/******************************************************************************
 * This API will do some initialization to various variables
 *
 *
 */
int wifi_direct_initialize(void);

/******************************************************************************
 * This API will do some deinitialization.
 *
 *
 */
int wifi_direct_deinitialize(void);

/******************************************************************************
 * Notification callback function type
 * State notification can occur at WiFi Direct state changed
 *
 */
typedef void (*wifi_direct_state_changed_cb) (int error_code,
                                wifi_direct_state_e device_state,
                                void *user_data);

/******************************************************************************
 * This API shall register a WiFi Direct state changed callback function to
 * monitor WiFi Direct state.
 *
 */
int wifi_direct_set_state_changed_cb(wifi_direct_state_changed_cb cb,
                                void *user_data);

/******************************************************************************
 * This API shall unregister a WiFi Direct state changed callback function.
 *
 *
 */
int wifi_direct_unset_state_changed_cb(void);

/******************************************************************************
 * Notification callback function type
 * Peer state notification can occur at remote peer state changed
 *
 */
typedef void (*wifi_direct_peer_state_changed_cb) (int error_code,
                                wifi_direct_peer_state_e peer_state,
                                wifi_direct_peer_info_s *peer, void *user_data);

/******************************************************************************
 * This API shall register a peer state changed callback function to monitor 
WiFi
 * Direct peer state changed.
 *
 */
int wifi_direct_set_peer_state_changed_cb(
                                wifi_direct_peer_state_changed_cb cb,
                                void *user_data);

/******************************************************************************
 * This API shall unregister a peer state changed callback function.
 *
 *
 */
int wifi_direct_unset_peer_state_changed_cb(void);

/******************************************************************************
 * Notification callback function type
 * Peer changed notification can occur at remote peers added or removed
 *
 */
typedef void (*wifi_direct_peers_changed_cb) (void *user_data);

/******************************************************************************
 * This API shall register the peers changed callback function to monitor WiFi
 * Direct remote peers added or removed. The callback may be invoked after scan.
 *
 */
int wifi_direct_set_peers_changed_cb(wifi_direct_peers_changed_cb cb,
                                void *user_data);

/******************************************************************************
 * This API shall unregister the peers changed callback function.
 *
 *
 */
int wifi_direct_unset_peers_changed_cb(void);

/******************************************************************************
 * Notification callback function type
 * Incoming connection notification can occur at an incoming request received
 * Here Only PBC incoming request supported
 */
typedef void (*wifi_direct_incoming_connection_cb) (
                                        wifi_direct_peer_info_s *peer,
                                        void *user_data);

/******************************************************************************
 * This API shall register an incoming connection callback function.
 * The callback will be invoked when an incoming connection received.
 *
 */
int wifi_direct_set_incoming_connection_cb(
                                wifi_direct_incoming_connection_cb cb,
                                void *user_data);

/******************************************************************************
 * This API shall unregister an incoming connection callback function.
 *
 *
 */
int wifi_direct_unset_incoming_connection_cb(void);

/******************************************************************************
 * Iterates callback function type for discovered peers
 * This function will be used by wifi_direct_foreach_discovered_peers
 *
 */
typedef bool (*wifi_direct_discovered_peer_cb) (wifi_direct_peer_info_s *peer,
                                                        void *user_data);

/******************************************************************************
 * This API shall get all the peers, and invoke the callback with the peers as
 * a parameter.
 *
 */
int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb cb,
                                                        void *user_data);

/******************************************************************************
 * Iterates callback function type for connected peers
 * This function will be used by wifi_direct_foreach_connected_peers
 *
 */
typedef bool (*wifi_direct_connected_peer_cb) (wifi_direct_peer_info_s *peer,
                                                        void *user_data);

/******************************************************************************
 * This API shall get all the connected peers, and invoke the callback with the
 * peers as a parameter.
 *
 */
int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb cb,
                                                        void *user_data);

/******************************************************************************
 * This API shall activate WiFi direct
 *
 *
 */
int wifi_direct_activate(void);

/******************************************************************************
 * This API shall deactivate WiFi direct
 *
 *
 */
int wifi_direct_deactivate(void);

/******************************************************************************
 * This API shall start a P2P scan process to find the peers
 *
 *
 */
int wifi_direct_start_discovery(void);

/******************************************************************************
 * This function will handle an incoming connection request.
 * Currently only incoming PBC connection is supported, set operation to 
 * WIFI_DIRECT_PBC_ACCEPT to accept the request, set operation to
 * WIFI_DIRECT_PBC_REJECT to reject it.
 */
int wifi_direct_handle_incoming_connection_request(
                        wifi_direct_peer_info_s *peer,
                        wifi_direct_incoming_connection_handler_e operation);

/******************************************************************************
 * This API will fill a valid pin code on the buffer which the parameter pointed
 * This function can be invoked when wps type is PIN and need to generate a pin
 * code.
 */
int wifi_direct_generate_wps_pin(char **pin);

/******************************************************************************
 * This API is only used when wifi_direct_connect_confirm_cb is invoked.
 * It give a wps method which users want to use. 
 * The third parameter must be filled with the pin code if wps type is PIN.
 *
 */
int wifi_direct_connection_confirm_wps_type(wifi_direct_peer_info_s *peer,
                                                wifi_direct_wps_type_e type,
                                                char *pin);

/******************************************************************************
 * Notification callback function type
 * This callback will be invoked when an outgoing connection starts.
 * Type is the peer supported wps configure method, user can decide which one
 * to use.
 * This callback maybe not be invoked if remote peer only supports PBC.
 */
typedef void (*wifi_direct_connection_confirm_cb) (
                                                wifi_direct_peer_info_s *peer,
                                                wifi_direct_wps_type_e type,
                                                void *user_data);

/******************************************************************************
 * This API shall start a p2p request
 * For example:
 * 1 Start a P2P outgoing request.
 * 2 Invite a peer into current P2P connection.
 * Callback can let user decide which wps method to use.
 */
int wifi_direct_connect(const wifi_direct_peer_info_s *peer, 
                                        wifi_direct_connection_confirm_cb cb,
                                        void *user_data);

/******************************************************************************
 * This API shall end a P2P connection
 * For example:
 * 1 Cancel an outgoing connection request.
 * 2 Destroy a found P2P connection with a peer.
 */
int wifi_direct_disconnect(const wifi_direct_peer_info_s *peer);

/******************************************************************************
 * This API shall end all the P2P connection with local side.
 *
 *
 */
int wifi_direct_disconnect_all(void);

/******************************************************************************
 * This API shall set local device name
 *
 *
 */
int wifi_direct_set_device_name(const char *device_name);

/******************************************************************************
 * This API shall get local device name
 *
 *
 */
int wifi_direct_get_device_name(char **device_name);

/******************************************************************************
 * This API shall get WiFi Direct state
 *
 *
 */
int wifi_direct_get_state(wifi_direct_state_e *state);

/******************************************************************************
 * This API shall add a WiFi Direct service
 * For example:
 * wifi_direct_service_add(WIFI_DIRECT_SERVICE_BONJOUR, <query hexdump>,
 *                                                      <RDATA hexdump>)
 */
int wifi_direct_service_add(wifi_direct_service_type_e type, char *data1,
                                char *data2);

/******************************************************************************
 * This API shall delete a WiFi Direct service
 *
 *
 */
int wifi_direct_service_del(wifi_direct_service_type_e type, char *data1,
                                char *data2);

/******************************************************************************
 * This API shall do a WiFi Display initialization with type, port, hdcp
 *
 *
 */
int wifi_direct_init_wifi_display(wifi_direct_display_type_e type, int port,
                                int hdcp);

/******************************************************************************
 * This API shall do a WiFi Display deinitialization.
 *
 *
 */
int wifi_direct_deinit_wifi_display(void);

/******************************************************************************
 * This API shall get WiFi Display port.
 *
 *
 */
int wifi_direct_get_display_port(int *port);

/******************************************************************************
 * This API shall get WiFi Display device type.
 *
 *
 */
int wifi_direct_get_display_type(wifi_direct_display_type_e *type);
_______________________________________________
Dev mailing list
[email protected]
https://lists.tizen.org/listinfo/dev

Reply via email to