![Mediatek Labs LinkIt Connect 7681 Developer'S Manual Download Page 47](http://html1.mh-extra.com/html/mediatek-labs/linkit-connect-7681/linkit-connect-7681_developers-manual_1760804047.webp)
MediaTek LinkIt™ Connect 7681 Developer's Guide
© 2015, 2016 MediaTek Inc.
Page 42 of 65
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
3)
IoT_Cust_SM_Smnt()
is located in
cust\Iot_custom.c
. Modify the default value of SSID
and Passphrase variables to match AP you wish to connect to, as follows:
void IoT_Cust_SM_Smnt
(
void
)
{
/* Example for customer's smart connection implementation*/
/* Step1: create parameter to store the smnt information */
/* or it is better to create a structure*/
uint8 Ssid
[
MAX_LEN_OF_SSID
+
1
]
=
"myap"
; <-- Sepecify SSID
here
uint8 Passphase
[
CIPHER_TEXT_LEN
]
=
"12345678"
; <-- Sepecify Key
here
uint8 PMK
[
CIPHER_TEXT_LEN
];
...
/*Step3: After smart connection done */
/* it need set smart connection information , then start to scan*/
/*The Authmode shall be detected in scan state again, if
AuthMode>WPA, PMK will be calculated in scan state*/
pIoTStaCfg
->
AuthMode
=
Ndis802_11AuthModeOpen
;
pIoTStaCfg
->
SsidLen
=
strlen
(
Ssid
);
pIoTStaCfg
->
PassphaseLen
=
strlen
(
Passphase
);
//sizeof(Passphase);
memcpy
(
pIoTStaCfg
->
Ssid
,
Ssid
,
pIoTStaCfg
->
SsidLen
);
memcpy
(
pIoTStaCfg
->
Passphase
,
Passphase
,
pIoTStaCfg
->
PassphaseLen
);
memcpy
(
pIoTStaCfg
->
PMK
,
PMK
,
strlen
(
PMK
));
wifi_state_chg
(
WIFI_STATE_SCAN
,
0
);
/* Change wifi state to SCAN*/
}
AuthMode
can be left unchanged, MT7681 will automatically determine authentication during
scanning.
MAX_LEN_OF_SSID
and
CIPHER_TEXT_LEN
are both 32. Don’t specify strings longer than 31
characters.
4)
run
make
to rebuild the project and use uploader to upload
MT7681_sta_header.bin
to the
device or development board.
Running the code on the device or development board will connect to the specified AP and the
following log will be sent to UART:
SM=0, Sub=0
SM=1, Sub=0
SM=2, Sub=0
SM=3, Sub=0
Auth with:ssid = myap, auth mode = 9, /* SSID specified */
SM=3, Sub=1
SM=4, Sub=0
SM=4, Sub=1
SM=5, Sub=0
[WTask]9301450
SM=6, Sub=0
Got IP:192.168.2.19