给现下流行的打车软件的一点小建议

一、前言:

最近北京出租车蓄意涨价,各地出租车行业估计也在跃跃欲试了吧。连芙蓉姐姐都正义出击了,虽然对我来说没有神马影响,不过还是要同情一下首都人民。

二、需求调研:

初到一个城市,由于中国同音字很多,经常会遇到一些地方叫不上名字,或者名字叫错的情况。你上车告诉师傅地方,说不准人家还会笑话你,宰你没商量。

三、想法(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/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

 

 

posted @ 2013-05-09 13:13  夜の魔王  阅读(2481)  评论(28编辑  收藏  举报