m2m_hw_usb_open

M2M_API_RESULT m2m_hw_usb_open (M2M_USB_CH channel, M2M_T_HW_USB_HANDLE

*handle)

 

Description: the function opens the selected USB channel and returns its handle, its behaviors depends on the USB opening mode that is set by m2m_hw_usb_set_open_ blocking() API. The default USB opening mode is in blocking mode. In this mode, it is mandatory that the USB cable is connected to the USB port, otherwise the function does not return the control until the cable is plugged in. If USB opening mode is set in no blocking mode and the USB cable is not plugged in, the function returns a failure indication and an error code.

 

 

Parameters:
channel:        USB channel to open as serial USB channel, refer to M2M_USB_CH enum
handle:                  pointer to the allocated variable that will be filled with the handle of the specified USB

channel

 

Return value:
         refer to M2M_API_RESULT enum 

 

Output data:
        
on success: handle of the specified USB channel
        
on failure:  refer to error codes for USB handle

 

NOTE: referring to M2M_USB_CH enum, if you use:

 

USB_CH_AUTO:     the function opens the first free USB channel, if any is available. The first free

USB channel depends on the ports configuration of the module set through the AT#PORTCFG command, refer to document [4]/[8].

 

USB_CH_DEFAULT: the function opens the USB_CH0.