GambitDev / F401RE-USBHost

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBHostSocketModem.h Source File

USBHostSocketModem.h

00001 /* mbed USBHost Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef USBHOSTSOCKETMODEM_H
00018 #define USBHOSTSOCKETMODEM_H
00019 
00020 #include "USBHostConf.h"
00021 #include "USBHost.h"
00022 
00023 
00024 /** 
00025  * A class to communicate a USB flash disk
00026  */
00027 class USBHostSocketModem : public IUSBEnumerator {
00028 public:
00029     /**
00030      * Constructor
00031      *
00032      * @param rootdir mount name
00033      */
00034     USBHostSocketModem();
00035 
00036     /**
00037      * Check if a MSD device is connected
00038      *
00039      * @return true if a MSD device is connected
00040      */
00041     bool connected();
00042 
00043     /**
00044      * Try to connect to a MSD device
00045      *
00046      * @return true if connection was successful
00047      */
00048     bool connect();
00049     
00050     /**
00051      * Send AT command test function.
00052      *
00053      * Sends the "AT" command which responds with "OK" if sim card is present else "ERROR".
00054      */
00055     void testAT();
00056 
00057 protected:
00058     //From IUSBEnumerator
00059     virtual void setVidPid(uint16_t vid, uint16_t pid);
00060     virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed
00061     virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
00062     
00063     //USB CDC initialization 
00064     virtual void setDTR();
00065         
00066 private:
00067     USBHost * host;
00068     USBDeviceConnected * dev;
00069     bool dev_connected;
00070     USBEndpoint * bulk_in;
00071     USBEndpoint * bulk_out;
00072     USBEndpoint * int_in;
00073     USBEndpoint * int_out;
00074     uint8_t nb_ep;
00075 
00076     int sm_intf;
00077     int int_intf;
00078     int bulk_intf;
00079     bool sm_device_found;
00080     
00081     void init();
00082 
00083 };
00084 
00085 #endif