This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Server for multithreaded (asynchronous) chat application.""" | |
from socket import AF_INET, socket, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR | |
from threading import Thread | |
import logging | |
from datetime import datetime | |
log_file = '/home/rover_logs/comm_server-log-' + datetime.now().strftime("%m-%d-%y") + '.txt' | |
logging.basicConfig(filename=log_file,level=logging.DEBUG) | |
logging.info('==================== Rover Battery Capacity Communications Server Logging Started ' + datetime.now().strftime("%m-%d-%y %H:%M:%S")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
temp = subprocess.Popen(args=['iwconfig wlan0 | grep -i quality'], stdout=subprocess.PIPE, shell=True) | |
wlan0_val, err = temp.communicate() | |
wlan0_strength = str(wlan0_val) | |
wlan0_strength = 'bb Link Quality=5/50 Signal level=-51 dBm \n' | |
cmp=wlan0_strength[25:33] | |
i=1 | |
while cmp[i]!='/': | |
i += 1 | |
cmp_num = cmp[:i] |
NewerOlder