給現下流行的打車軟件的一點小建議


一、前言:

最近北京出租車蓄意漲價,各地出租車行業估計也在躍躍欲試了吧。連芙蓉姐姐都正義出擊了,雖然對我來說沒有神馬影響,不過還是要同情一下首都人民。

二、需求調研:

初到一個城市,由於中國同音字很多,經常會遇到一些地方叫不上名字,或者名字叫錯的情況。你上車告訴師傅地方,說不准人家還會笑話你,宰你沒商量。

三、想法(idea):

現在的打車軟件主要的功能是叫車,叫道車后就沒他什么事了。我突發奇想:可不可以把叫車-車上-車下的范圍都納入打車軟件呢。

前段時間搞了一哈二維碼這個東西,覺得不錯。日本人有些東西發明的還是不錯的。雖然只是照搬的條形碼原理,但是已經進步很多了。

叫車就不說了,車下無非就是給司機服務評分之類。現在主要說說車上的事情,還是回到需求:叫不上名字或叫錯名字,怕挨宰。結合二維碼的思想,我們可以在出發前查好地址,然后打車軟件里面生成二維碼,並且共享在打車軟件的服務器里,當然有詳細地址的經緯度等其他必要的信息。上車后你就不用說話了,直接通過藍牙或者其他的東西發到司機的app里面,甚至你可以自己規划路線,計算公里數和費用,做的在一條龍一點:可以在打車軟件里面完成買單,電子支付。

這樣打車軟件才有前途,做的好了,司機的服務質量也會提高,整個行業就互聯網化了,人類也就進步了,我們離理想社會,和諧社會更近了一步不是?

四、解決方案:

1.掃描二維碼:

    1.1:Google的開源zxing項目:http://code.google.com/p/zxing/,支持:

  • actionscript: partial port to Actionscript
  • cpp: Partial C++ port
  • iphone: iPhone client + port to Objective C / C++ (QR code only)
  • csharp: Partial C# port

    1.2:ThroughWork

    1.3:web的我當時用的是:http://qrcode.com/

    1.4:Windows系統下調用攝像頭:http://www.deepleo.com/archives/1518,下載源代碼

下面貼出關鍵源代碼:

public class CamWorker
    {
        private const int WM_USER = 0x400;
        private const int WS_CHILD = 0x40000000;
        private const int WS_VISIBLE = 0x10000000;
        private const int WM_CAP_START = WM_USER;
        private const int WM_CAP_STOP = WM_CAP_START + 68;
        private const int WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
        private const int WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
        private const int WM_CAP_SAVEDIB = WM_CAP_START + 25;
        private const int WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
        private const int WM_CAP_SEQUENCE = WM_CAP_START + 62;
        private const int WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
        private const int WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63;
        private const int WM_CAP_SET_OVERLAY = WM_CAP_START + 51;
        private const int WM_CAP_SET_PREVIEW = WM_CAP_START + 50;
        private const int WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6;
        private const int WM_CAP_SET_CALLBACK_ERROR = WM_CAP_START + 2;
        private const int WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3;
        private const int WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5;
        private const int WM_CAP_SET_SCALE = WM_CAP_START + 53;
        private const int WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52;
        private IntPtr hWndC;
        private bool bWorkStart = false;
        private IntPtr mControlPtr;
        private int mWidth;
        private int mHeight;
        private int mLeft;
        private int mTop;

        /// <summary>
        /// 初始化顯示圖像
        /// </summary>
        /// <param name= “handle “> 控件的句柄 </param>
        /// <param name= “left “> 開始顯示的左邊距 </param>
        /// <param name= “top “> 開始顯示的上邊距 </param>
        /// <param name= “width “> 要顯示的寬度 </param>
        /// <param name= “height “> 要顯示的長度 </param>
        public CamWorker(IntPtr handle, int left, int top, int width, int height)
        {
            mControlPtr = handle;
            mWidth = width;
            mHeight = height;
            mLeft = left;
            mTop = top;
        }

        [DllImport("avicap32.dll ")]
        private static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, int nID);

        [DllImport("avicap32.dll ")]
        private static extern int capGetVideoFormat(IntPtr hWnd, IntPtr psVideoFormat, int wSize);

        //
        //這里特別注意,因為WinAPI中的long為32位,而C#中的long為64wei,所以需要將lParam該為int
        //
        [DllImport("User32.dll ")]
        private static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);

        /// <summary>
        /// 開始顯示圖像
        /// </summary>
        public void Start()
        {
            if (bWorkStart)
                return;

            bWorkStart = true;
            byte[] lpszName = new byte[100];

            hWndC = capCreateCaptureWindowA(lpszName, WS_CHILD | WS_VISIBLE, mLeft, mTop, mWidth, mHeight, mControlPtr, 0);

            if (hWndC.ToInt32() != 0)
            {
                SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
                SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0);
                SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0);
                SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
                SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0);
                SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0);
                SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0);
                SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0);
                //Global.log.Write( “SendMessage “);
            }
            return;

        }

        /// <summary>
        /// 停止顯示
        /// </summary>
        public void Stop()
        {
            SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
            bWorkStart = false;
        }

        /// <summary>
        /// 抓圖
        /// </summary>
        /// <param name= “path “> 要保存bmp文件的路徑 </param>
        public void GrabImage(string path)
        {
            IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);
            SendMessage(hWndC, WM_CAP_SAVEDIB, 0, hBmp.ToInt32());
        }
    }

 

1.5:html5(refrence:juery):下載源代碼

其他的,沒時間想了,上班了,以后在做。敬請各位大神板磚。。。

 

笑話:

一個女人死了,一個男人干掉幾百守衛最后抱走她的是美國電影;一會兒工夫她掙扎着變成吸血鬼的是英國電影;一群人突然冒出來又唱又跳的是印度電影;一個天山雪蓮給她灌進去於是復活了的是香港電影;一個猥瑣男人爬到她身上做活塞運動的是日本電影;一個組織把她追認為組織成員的是中國電影。

加水印:作者:深邃的獅子座
出處:http://www.deepleo.com/
本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM