首页 > Windows开发 > 详细

MTK elian(smartlink)在WIN32下的实现

时间:2016-09-20 19:59:10      阅读:874      评论:0      收藏:0      [点我收藏+]
先说明一下调试技巧:该程序需无线网卡实现功能,由于PC端有可能是多网卡的(有线网卡、无线网卡、虚拟网卡),所以在发包的时候数据包不一定会从无线网卡出,lib库应该也没处理多网卡的选择吧。所以在调试的时候需把除了无线网卡之外的网卡(有线网卡、虚拟网卡)都禁用,程序在执行的时候,会有大量数据通过网口,因此也可以通过Wireshark查看到网卡端口是否有数据出入,只要打开如下界面即可。
技术分享
 
实现代码:
  1. #include <stdio.h>
  2. #include<string.h>
  3. #include"elian.h"
  4. #pragma comment(lib,"elian.lib")
  5. int main(int argc,char*argv[])
  6. {
  7. unsignedchar target[]={0xff,0xff,0xff,0xff,0xff,0xff};
  8. int ret =0;
  9. unsignedint flag = ELIAN_SEND_V4;
  10. void*handle = NULL;
  11. unsignedchar authmode =0x04;
  12. printf("Create elian Handle\n");
  13. handle = elianNew(NULL,0, target, ELIAN_SEND_V4);
  14. printf("Set TYPE_ID_AM\n");
  15. ret = elianPut(handle, TYPE_ID_AM,(char*)&authmode,1);
  16. printf("Set TYPE_ID_SSID ret=%d\n", ret);
  17. ret = elianPut(handle, TYPE_ID_SSID,"Rookie", strlen("Rookie"));
  18. printf("Set TYPE_ID_PWD ret=%d\n", ret);
  19. ret = elianPut(handle, TYPE_ID_PWD,"123123123", strlen("123123123"));
  20. printf("Set TYPE_ID_CUST ret=%d\n", ret);
  21. ret = elianPut(handle, TYPE_ID_CUST,"aaaaaaa", strlen("aaaaaaa"));
  22. printf("elianStart ret=%d\n", ret);
  23. elianStart(handle);
  24. getchar();
  25. elianStop(handle);
  26. elianDestroy(handle);
  27. }
 
指定elian.lib库路径:
技术分享
 
 
 
 





MTK elian(smartlink)在WIN32下的实现

原文:http://www.cnblogs.com/lancersworld/p/5890030.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!