ESP32 怎么查询当前的网络状态

怎么知道当前的ESP32是无线连接、有线连接、无网络、无线连接(无网络)还是有线连接(无网络)状态呢?

https://jingyan.baidu.com/article/1612d500a29e8ce20e1eeea3.html