MTK elian(smartlink)在WIN32下的实现

先说明一下调试技巧:该程序需无线网卡实现功能,由于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库路径:
 
 
 
 





转载于:https://www.cnblogs.com/lancersworld/p/5890030.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值