TP-LINK路由器设置步骤详解

需积分: 11 2 下载量 124 浏览量 更新于2024-07-31 收藏 2.07MB DOC 举报
"TP_LINE路由器的设置方法主要针对的是TP-LINK品牌的路由器,通过一系列步骤来实现多台电脑共享上网的功能。以下是对设置过程的详细解释: 1. **基础设备准备**: - 路由器:根据需求选择4口、8口、16口或更多口的路由器,如TP-LINK TL-402M。 - 交换机(可选):如果电脑数量多,可以增加交换机扩展端口。 - 网线:至少需要几条直通线用于连接设备。 - MODEM(调制解调器):如果是通过电信宽带接入,需要一个MODEM,专线用户则不需要。 2. **硬件连接**: - 连接MODEM到路由器的WAN口。 - 使用网线将PC电脑连接到路由器的LAN口,至少需要两台电脑。 - 确保所有设备之间的连接正确无误。 3. **电脑IP配置**: - 在任意一台连接路由器的电脑上,打开网络设置,设置TCP/IP协议。 - 将IP地址设置为192.168.1.2,子网掩码为255.255.255.0,网关设置为192.168.1.1。 - DNS服务器地址通常在配置路由器后设置,对于98和ME系统,需在控制面板的网络连接中进行设置。 4. **访问路由器管理界面**: - 打开浏览器,输入路由器的默认IP地址192.168.1.1并回车。 - 输入默认的用户名和密码(通常均为“admin”),进入路由器的管理界面。 5. **路由器配置**: - 在管理界面中,按照向导或手动配置网络参数,如PPPoE拨号、静态IP或动态DHCP等,这取决于你的宽带接入方式。 - 配置无线网络(如果路由器支持)包括SSID、加密方式和密码。 - 设置DNS服务器地址,通常可以从ISP获取,也可以使用公共DNS如Google的8.8.8.8和8.8.4.4。 - 保存并应用配置。 6. **其他电脑设置**: - 其他电脑同样设置TCP/IP协议,但IP地址应设置在192.168.1.2-192.168.1.254范围内,避免IP冲突。 完成以上步骤后,所有连接到路由器的电脑都将能够共享互联网连接。注意,为了网络安全,应及时更改路由器的默认登录凭据,并考虑启用MAC地址过滤或其他安全措施。此外,根据实际需要,可能还需要进行端口映射、QoS(服务质量)设置等高级配置。

修改这个函数,要实现防止连续点按 while (1) { tp_dev.scan(0); if (tp_dev.sta & TP_PRES_DOWN) { //触摸屏被按下 if (tp_dev.x[0] > 0 && tp_dev.x[0] < 130 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 0 && tp_dev.x[0] < 130 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i < 5) { password[i++] = '1'; } } else if (tp_dev.x[0] > 130 && tp_dev.x[0] < 260 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 130 && tp_dev.x[0] < 260 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i < 5) { password[i++] = '2'; } } else if (tp_dev.x[0] > 260 && tp_dev.x[0] < 390 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 260 && tp_dev.x[0] < 390 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i < 5) { password[i++] ='3'; } } else if (tp_dev.x[0] > 390 && tp_dev.x[0] < 520 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 390 && tp_dev.x[0] < 520 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i < 5) { password[i++] = '4'; } } else if (tp_dev.x[0] > 520 && tp_dev.x[0] < 650 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 520 && tp_dev.x[0] < 650 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i > 0) { password[--i] = '\0'; } } else if (tp_dev.x[0] > 650 && tp_dev.x[0] < 800 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480) { while(tp_dev.x[0] > 650 && tp_dev.x[0] < 800 && tp_dev.y[0] > 380 && tp_dev.y[0] < 480){ tp_dev.scan(0); } if (i == 4) { break; //退出密码输入循环 } else { Show_Hz16(300,250,"提示信息:用户名或密码错误",RED,WHITE); } } //显示部分 LCD_ShowString(400,150,400,24,24,password); } }

2023-05-22 上传

对以下代码进行注释并给出可复制代码static void ble_tp_notify_task(void *pvParameters) { int err = -1; char data[244] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; while(1) { err = bt_gatt_notify(ble_tp_conn, get_attr(BT_CHAR_BLE_TP_NOT_ATTR_VAL_INDEX), data, (tx_mtu_size - 3)); BT_WARN("ble tp send notify : %d", err); } } static void ble_tp_not_ccc_changed(const struct bt_gatt_attr attr, u16_t value) { int err; BT_WARN("ccc:value=[%d]",value); if(tp_start) { if(value == BT_GATT_CCC_NOTIFY) { if(xTaskCreate(ble_tp_notify_task, (char)"bletp", 256, NULL, TP_PRIO, &ble_tp_task_h) == pdPASS) { created_tp_task = 1; BT_WARN("Create throughput tx task success."); } else { created_tp_task = 0; BT_WARN("Create throughput tx task fail."); } } else { if(created_tp_task) { BT_WARN("Delete throughput tx task."); vTaskDelete(ble_tp_task_h); created_tp_task = 0; } } } else { if(created_tp_task) { BT_WARN("Delete throughput tx task."); vTaskDelete(ble_tp_task_h); created_tp_task = 0; } if(value == BT_GATT_CCC_NOTIFY) { err = bt_gatt_notify(ble_tp_conn, get_attr(BT_CHAR_BLE_TP_NOT_ATTR_VAL_INDEX), "notify", strlen("notify")); BT_WARN("ble tp send indatcate: %d", err); } } } static struct bt_gatt_attr attrs[]= { BT_GATT_PRIMARY_SERVICE(BT_UUID_SVC_BLE_TP), BT_GATT_CHARACTERISTIC(BT_UUID_CHAR_BLE_TP_RD, BT_GATT_CHRC_READ, BT_GATT_PERM_READ, ble_tp_recv_rd, NULL, NULL), BT_GATT_CHARACTERISTIC(BT_UUID_CHAR_BLE_TP_WR, BT_GATT_CHRC_WRITE |BT_GATT_CHRC_WRITE_WITHOUT_RESP, BT_GATT_PERM_WRITE|BT_GATT_PERM_PREPARE_WRITE, NULL, ble_tp_recv_wr, NULL), BT_GATT_CHARACTERISTIC(BT_UUID_CHAR_BLE_TP_IND, BT_GATT_CHRC_INDICATE, 0, NULL, NULL, NULL), BT_GATT_CCC(ble_tp_ind_ccc_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), BT_GATT_CHARACTERISTIC(BT_UUID_CHAR_BLE_TP_NOT, BT_GATT_CHRC_NOTIFY, 0, NULL, NULL, NULL), BT_GATT_CCC(ble_tp_not_ccc_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE) };

2023-05-19 上传

注释以下代码#define TP_PRIO configMAX_PRIORITIES - 5 static void ble_tp_connected(struct bt_conn *conn, u8_t err); static void ble_tp_disconnected(struct bt_conn *conn, u8_t reason); static int bl_tp_send_indicate(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, u16_t len); struct bt_conn *ble_tp_conn; struct bt_gatt_exchange_params exchg_mtu; TaskHandle_t ble_tp_task_h; int tx_mtu_size = 20; u8_t tp_start = 0; static u8_t created_tp_task = 0; static u8_t isRegister = 0; static struct bt_conn_cb ble_tp_conn_callbacks = { .connected = ble_tp_connected, .disconnected = ble_tp_disconnected, }; static void ble_tp_tx_mtu_size(struct bt_conn *conn, u8_t err, struct bt_gatt_exchange_params *params) { if(!err) { tx_mtu_size = bt_gatt_get_mtu(ble_tp_conn); BT_WARN("ble tp echange mtu size success, mtu size: %d", tx_mtu_size); } else { BT_WARN("ble tp echange mtu size failure, err: %d", err); } } static void ble_tp_connected(struct bt_conn *conn, u8_t err) { if(err || conn->type != BT_CONN_TYPE_LE) { return; } int tx_octets = 0x00fb; int tx_time = 0x0848; int ret = -1; BT_INFO("%s",__func__); ble_tp_conn = conn; . ret = bt_le_set_data_len(ble_tp_conn, tx_octets, tx_time); if(!ret) { BT_WARN("ble tp set data length success."); } else { BT_WARN("ble tp set data length failure, err: %d\n", ret); } exchg_mtu.func = ble_tp_tx_mtu_size; ret = bt_gatt_exchange_mtu(ble_tp_conn, &exchg_mtu); if (!ret) { BT_WARN("ble tp exchange mtu size pending."); } else { BT_WARN("ble tp exchange mtu size failure, err: %d", ret); } } static void ble_tp_disconnected(struct bt_conn *conn, u8_t reason) { if(conn->type != BT_CONN_TYPE_LE) { return; } BT_INFO("%s",__func__); ble_tp_conn = NULL; } static int ble_tp_recv_rd(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) { int size = 9; char data[9] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; memcpy(buf, data, size); return size; }

2023-05-19 上传

解释代码#define TP_PRIO configMAX_PRIORITIES - 5 static void ble_tp_connected(struct bt_conn *conn, u8_t err); static void ble_tp_disconnected(struct bt_conn *conn, u8_t reason); static int bl_tp_send_indicate(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, u16_t len); struct bt_conn *ble_tp_conn; struct bt_gatt_exchange_params exchg_mtu; TaskHandle_t ble_tp_task_h; int tx_mtu_size = 20; u8_t tp_start = 0; static u8_t created_tp_task = 0; static u8_t isRegister = 0; static struct bt_conn_cb ble_tp_conn_callbacks = { .connected = ble_tp_connected, .disconnected = ble_tp_disconnected, }; static void ble_tp_tx_mtu_size(struct bt_conn *conn, u8_t err, struct bt_gatt_exchange_params *params) { if(!err) { tx_mtu_size = bt_gatt_get_mtu(ble_tp_conn); BT_WARN("ble tp echange mtu size success, mtu size: %d", tx_mtu_size); } else { BT_WARN("ble tp echange mtu size failure, err: %d", err); } } static void ble_tp_connected(struct bt_conn *conn, u8_t err) { if(err || conn->type != BT_CONN_TYPE_LE) { return; } int tx_octets = 0x00fb; int tx_time = 0x0848; int ret = -1; BT_INFO("%s",__func__); ble_tp_conn = conn; . ret = bt_le_set_data_len(ble_tp_conn, tx_octets, tx_time); if(!ret) { BT_WARN("ble tp set data length success."); } else { BT_WARN("ble tp set data length failure, err: %d\n", ret); } exchg_mtu.func = ble_tp_tx_mtu_size; ret = bt_gatt_exchange_mtu(ble_tp_conn, &exchg_mtu); if (!ret) { BT_WARN("ble tp exchange mtu size pending."); } else { BT_WARN("ble tp exchange mtu size failure, err: %d", ret); } } static void ble_tp_disconnected(struct bt_conn *conn, u8_t reason) { if(conn->type != BT_CONN_TYPE_LE) { return; } BT_INFO("%s",__func__); ble_tp_conn = NULL; } static int ble_tp_recv_rd(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) { int size = 9; char data[9] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; memcpy(buf, data, size); return size; }

2023-05-19 上传