def sendSysinfo(self, full): self.send(NUM_SYSINFO_REPLY_START) self.send(NUM_SYSINFO_REPLY_LINE, "program_version", VERSION) self.send(NUM_SYSINFO_REPLY_LINE, "battery", sysinfo.battery()) self.send(NUM_SYSINFO_REPLY_LINE, "active_profile", sysinfo.active_profile()) self.send(NUM_SYSINFO_REPLY_LINE, "free_ram", sysinfo.free_ram()) self.send(NUM_SYSINFO_REPLY_LINE, "pys60_version", e32.pys60_version) if sysinfo.active_profile() == u"offline": # Return an error code if the phone is in offline mode self.send(NUM_SYSINFO_REPLY_LINE, "signal_dbm", -1) self.send(NUM_SYSINFO_REPLY_LINE, "signal_bars", -1) else: self.send(NUM_SYSINFO_REPLY_LINE, "signal_dbm", sysinfo.signal_dbm()) self.send(NUM_SYSINFO_REPLY_LINE, "signal_bars", sysinfo.signal_bars()) for drive, free in sysinfo.free_drivespace().iteritems(): self.send(NUM_SYSINFO_REPLY_LINE, "free_drivespace", str(drive) + str(free)) if full: self.send(NUM_SYSINFO_REPLY_LINE, "display", str(sysinfo.display_pixels()[0]) + "x" + str(sysinfo.display_pixels()[1])) self.send(NUM_SYSINFO_REPLY_LINE, "imei", sysinfo.imei()) self.send(NUM_SYSINFO_REPLY_LINE, "model", sysinfo.sw_version()) self.send(NUM_SYSINFO_REPLY_LINE, "s60_version", e32.s60_version_info[0], e32.s60_version_info[1] ) self.send(NUM_SYSINFO_REPLY_LINE, "total_ram", sysinfo.total_ram()) self.send(NUM_SYSINFO_REPLY_LINE, "total_rom", sysinfo.total_rom()) self.send(NUM_SYSINFO_REPLY_END)
def notify(message): print 'notify', message playload = {'key': KEY, 'message': message.encode('utf8'), 'battery': sysinfo.battery()} params = urllib.urlencode(playload) remote_fh = urllib.urlopen(URL, params) result = remote_fh.read() return result
def notify(message): print 'notify', message playload = { 'key': KEY, 'message': message.encode('utf8'), 'battery': sysinfo.battery() } params = urllib.urlencode(playload) remote_fh = urllib.urlopen(URL, params) result = remote_fh.read() return result
def Info(): #print 'Device Time: ' + sysinfo.active_profile() print 'Active Profile: '.ljust(24) + sysinfo.active_profile() print 'Software Version: '.ljust(24) + str(sysinfo.sw_version()) print 'OS Version: '.ljust(24) + str(sysinfo.os_version()) print 'Battery: '.ljust(24) + str(sysinfo.battery()) + '%' print 'Display Resolution: '.ljust(24) + str( sysinfo.display_pixels()[0]) + 'x' + str(sysinfo.display_pixels()[1]) print 'IMEI: '.ljust(24) + sysinfo.imei() #print 'RAM Drive Size: ' + str(sysinfo.max_ramdrive_size()) print 'RAM Size(total/free): '.ljust(24) + str(sysinfo.total_ram()) + str( sysinfo.free_ram()) print 'ROM Size: '.ljust(24) + str(sysinfo.total_rom()) print 'Free Drive Space: '.ljust(24) + str(sysinfo.free_drivespace()) print 'Signal Strength:'.ljust(24) + str(sysinfo.signal_bars())
def sendSysinfo(self, full): self.send(NUM_SYSINFO_REPLY_START) self.send(NUM_SYSINFO_REPLY_LINE, "program_version", VERSION) self.send(NUM_SYSINFO_REPLY_LINE, "battery", sysinfo.battery()) self.send(NUM_SYSINFO_REPLY_LINE, "active_profile", sysinfo.active_profile()) self.send(NUM_SYSINFO_REPLY_LINE, "free_ram", sysinfo.free_ram()) self.send(NUM_SYSINFO_REPLY_LINE, "pys60_version", e32.pys60_version) if sysinfo.active_profile() == "offline": # Return an error code if the phone is in offline mode self.send(NUM_SYSINFO_REPLY_LINE, "signal_dbm", -1) self.send(NUM_SYSINFO_REPLY_LINE, "signal_bars", -1) else: self.send(NUM_SYSINFO_REPLY_LINE, "signal_dbm", sysinfo.signal_dbm()) self.send(NUM_SYSINFO_REPLY_LINE, "signal_bars", sysinfo.signal_bars()) for drive, free in sysinfo.free_drivespace().items(): self.send(NUM_SYSINFO_REPLY_LINE, "free_drivespace", str(drive) + str(free)) if full: self.send( NUM_SYSINFO_REPLY_LINE, "display", str(sysinfo.display_pixels()[0]) + "x" + str(sysinfo.display_pixels()[1]), ) self.send(NUM_SYSINFO_REPLY_LINE, "imei", sysinfo.imei()) self.send(NUM_SYSINFO_REPLY_LINE, "model", sysinfo.sw_version()) self.send( NUM_SYSINFO_REPLY_LINE, "s60_version", e32.s60_version_info[0], e32.s60_version_info[1], ) self.send(NUM_SYSINFO_REPLY_LINE, "total_ram", sysinfo.total_ram()) self.send(NUM_SYSINFO_REPLY_LINE, "total_rom", sysinfo.total_rom()) self.send(NUM_SYSINFO_REPLY_END)
def app(): appuifw.app.exit_key_handler = lock.signal active_profile = sysinfo.active_profile() battery = sysinfo.battery() d1, d2 = sysinfo.display_pixels() free_ram = sysinfo.free_ram() / float(1024 * 1024) total_ram = sysinfo.total_ram() / float(1024 * 1024) imei = sysinfo.imei() sw_version_list = sysinfo.sw_version().split(' ') data_list = [(ru("Active Profile:"), ru(active_profile)), (ru("Battery Percentage:"), ru(battery)), (ru("Free RAM:"), ru(str(free_ram)[:6] + " MB/" + str(total_ram)[:6] + " MB")), (ru("Display:"), ru(str(d1) + " x " + str(d2))), (ru("IMEI:"), imei), (u"Software Version:", sw_version_list[0]), (u"Software Version Date:", sw_version_list[1]), (u"Type", sw_version_list[2])] list = appuifw.Listbox(data_list, lambda: None) appuifw.app.body = list appuifw.app.menu = [(u"Refresh Info", app), (u"About", about)]
import sysinfo, appuifw, e32 #sysinfo是与系统信息有关的模块 def cn(x): return x.decode("utf8") appuifw.app.body = t = appuifw.Text() t.focus = False appuifw.app.screen = "full" t.add(cn("情景模式:") + sysinfo.active_profile()) #查看当前情景模式 t.add(cn("\n电量:") + unicode(sysinfo.battery())) #查看当前电量 t.add(cn("\n屏幕分辨率:") + unicode(sysinfo.display_pixels())) #查看屏幕分辨率 t.add(cn("\n剩余空间:\n")) i = 0 drive = [u"C:", u"D:", u"E:"] while i < len(drive): #循环语句 t.add(drive[i] + unicode(sysinfo.free_drivespace()[drive[i]] / 1024) + u"kb\n") #查看C,D,E盘剩余空间 i += 1 t.add(cn("剩余运存:") + unicode(sysinfo.free_ram() / 1024) + u"kb") #查看剩余运存 t.add(cn("\nIMEI:") + unicode(sysinfo.imei())) #查看手机串号 t.add(cn("\n系统版本:") + unicode(sysinfo.os_version())) #查看系统版本信息 t.add(cn("\n响铃方式:") + unicode(sysinfo.ring_type())) #查看响铃方式 t.add(cn("\n手机版本:") + unicode(sysinfo.sw_version())) #查看手机版本 t.add(cn("\n缓存总大小:") + unicode(sysinfo.total_ram() / 1024) + u"kb") #查看剩余缓存 t.add(cn("\nZ盘总大小:") + unicode(sysinfo.total_rom() / 1024) + u"kb") #查看Z盘总大小 e32.Ao_lock().wait()
recvd = 1 except: recvd = 0 try: inputJSON = json.read(rdata) except: print "broke during recv" continue if(inputJSON['payload']!=[]): for e_msg in inputJSON['payload']: checkme = e_msg['msg'] the_act_msg = string.split(checkme," ") the_users = the_act_msg[1] the_sjstat = the_act_msg[0] # check for control message and send details if(the_sjstat==controlMessage): themsg = "battery level: "+str(battery())+" Users: "+str(the_users) else: themsg = e_msg['msg'] sendto = e_msg['to'] sendtest=0 while(sendtest!=1): try: messaging.sms_send(sendto,themsg) sendtest=1 except: sendtest=0
def pasek(): global screen global img global ekran global mp3 global ladow while 1: e32.Ao_timer().after(1) (rok, mies, dz, godz, min, sek, x, x, x) = time.localtime() godz = '%02d' % (godz) min = '%02d' % (min) sek = '%02d' % (sek) if (godz == ustaw[51:53]) and (min == ustaw[53:55]) and ( sek == '00') and (pb <> 'None'): e32.reset_inactivity() try: appuifw.e32.start_exe( u'c:\\sys\\bin\\' + unicode(pb) + u'.exe', '') except: try: appuifw.e32.start_exe( u'e:\\sys\\bin\\' + unicode(pb) + u'.exe', '') except: try: appuifw.e32.start_exe( u'z:\\sys\\bin\\' + unicode(pb) + u'.exe', '') except: pass try: if (int(ustaw[36:39]) <> 0) and (sysinfo.active_profile() <> u'silent'): if ((int(min) == 0) and (int(sek) == 0) or (int(sysinfo.battery()) == 100) and (ladow > 0)): if (int(sysinfo.battery()) == 100) and (ladow > 0): ladow = 0 if os.path.isdir(sciezkaplik): if (int(min) == 0) and (int(sek) == 0): mp3 = audio.Sound.open( unicode(sciezkaplik + '\\' + str(godz) + '.mp3')) else: mp3 = audio.Sound.open( unicode(sciezkaplik + '\\' + '24.mp3')) else: mp3 = audio.Sound.open(unicode(sciezkaplik)) if (int(ustaw[39:42]) < int(ustaw[42:45])) and ( int(godz) >= int(ustaw[39:42])) and ( int(godz) <= int(ustaw[42:45])): mp3.play() elif (int(ustaw[39:42]) > int(ustaw[42:45])) and ( (int(godz) >= int(ustaw[39:42])) or (int(godz) <= int(ustaw[42:45]))): mp3.play() elif int(godz) == int(ustaw[39:42]): mp3.play() audio.Sound.set_volume( mp3, int( audio.Sound.max_volume(mp3) * (float(int(ustaw[36:39])) / float(100)))) if audio.Sound.state(mp3) <> 2: mp3 = 0 if (int(min) == 0) and (int(sek) == 0): if (int(ustaw[39:42]) < int(ustaw[42:45])) and ( int(godz) >= int(ustaw[39:42])) and (int(godz) <= int( ustaw[42:45])): miso.vibrate(500, 100) elif (int(ustaw[39:42]) > int(ustaw[42:45])) and ( (int(godz) >= int(ustaw[39:42])) or (int(godz) <= int(ustaw[42:45]))): miso.vibrate(500, 100) elif int(godz) == int(ustaw[39:42]): miso.vibrate(500, 100) except: pass if int(ustaw[18:21]) == 888: img.blit(ima, ((0, 0), (int(ustaw[0:3]), int(ustaw[3:6])))) else: img.rectangle( [(0, 0), (int(ustaw[0:3]), int(ustaw[3:6]))], (int(ustaw[18:21]), int(ustaw[21:24]), int(ustaw[24:27])), fill=(int(ustaw[18:21]), int(ustaw[21:24]), int(ustaw[24:27]))) if pb <> 'None': img.line([(0, 0), (0, int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(-1 + int(ustaw[0:3]), 0), (-1 + int(ustaw[0:3]), int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) if fpp[int(ustaw[56:57])] <> 'None': img.line([(0, 0), (0, 4)], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(0, 0), (4, 0)], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(-1 + int(ustaw[0:3]), 0), (-1 + int(ustaw[0:3]), 4)], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(-1 + int(ustaw[0:3]), 0), (-1 - 4 + int(ustaw[0:3]), 0)], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(-1 + int(ustaw[0:3]), -1 + int(ustaw[3:6])), (-1 - 4 + int(ustaw[0:3]), -1 + int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(-1 + int(ustaw[0:3]), -1 + int(ustaw[3:6])), (-1 + int(ustaw[0:3]), -1 - 4 + int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(0, -1 + int(ustaw[3:6])), (0, -1 - 4 + int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) img.line([(0, -1 + int(ustaw[3:6])), (4, -1 + int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) if ekran > 0: e32.reset_inactivity() img.line([(0, -1 + int(ustaw[3:6])), (int(ustaw[0:3]), -1 + int(ustaw[3:6]))], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) if ladow > 0: img.line([(0, 0), (int(ustaw[0:3]), 0)], (int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) if int(ustaw[45:48]) / 10 > 0: if int(ustaw[45:48]) / 10 == 1: k = unicode(str(godz) + ':' + str(min) + ':' + str(sek)) elif int(ustaw[45:48]) / 10 == 2: k = unicode('%02i' % (dz) + '.' + '%02i' % (mies) + '.' + str(rok)) elif int(ustaw[45:48]) / 10 == 3: k = unicode('%06.3f' % (float(sysinfo.free_ram()) / float(1000000))) elif int(ustaw[45:48]) / 10 == 4: k = unicode('%03i' % (sysinfo.signal_dbm()) + ' dBm') elif int(ustaw[45:48]) / 10 == 5: k = unicode('%03i' % (sysinfo.battery()) + ' %') if int(ustaw[45:48]) % 10 == 1: q = (None, None, graphics.FONT_BOLD | graphics.FONT_ANTIALIAS) elif int(ustaw[45:48]) % 10 == 2: q = (None, None, graphics.FONT_ITALIC | graphics.FONT_ANTIALIAS) elif int(ustaw[45:48]) % 10 == 3: q = (None, None, graphics.FONT_BOLD | graphics.FONT_ITALIC | graphics.FONT_ANTIALIAS) else: q = (None, None, graphics.FONT_ANTIALIAS) img.text( (int(ustaw[12:15]), int(ustaw[15:18])), k, font=q, fill=(int(ustaw[27:30]), int(ustaw[30:33]), int(ustaw[33:36]))) screen.background_color = 0xffffff else: screen.hide()
import sys import os import time import sysinfo import e32 sys.stdout.write("IMEI: %s\n" % sysinfo.imei()) sys.stdout.write("Battery strength: %s\n" % sysinfo.battery()) sys.stdout.write("Signal strength: %s\n" % sysinfo.signal_bars()) sys.stdout.write("Network signal strength in dBm: %s\n" % sysinfo.signal_dbm()) sys.stdout.write("SW version: %s\n" % sysinfo.sw_version()) sys.stdout.write("Display size:\n") print(sysinfo.display_pixels()) sys.stdout.write("Current profile: %s\n" % sysinfo.active_profile()) sys.stdout.write("Ringing type: %s\n" % sysinfo.ring_type()) sys.stdout.write("OS version:\n") print(sysinfo.os_version()) sys.stdout.write("Free/total RAM (MB): %.2f / %.2f\n" % (sysinfo.free_ram()/1024/1024,sysinfo.total_ram()/1024/1024)) sys.stdout.write("Total ROM (MB): %.2f \n" % (sysinfo.total_rom()/1024/1024)) sys.stdout.write("Free disk space C/E (MB): %.2f / %.2f\n" % (sysinfo.free_drivespace()['C:']/1024/1024,sysinfo.free_drivespace()['E:']/1024/1024))
def screenshot(): img = graphics.screenshot() img.save("E:\\Images\\temp.jpg") return file("E:\\Images\\temp.jpg").read() go_on = True msg = {} print "Web service starts..." while go_on: ret = {} for path in json_request(msg): print "Requesting", path if path == "/camera.jpg": ret[path] = ("image/jpeg", take_photo()) elif path == "/screenshot.jpg": ret[path] = ("image/jpeg", screenshot()) elif path == "/battery": ret[path] = ("text/plain",\ "Current battery level is %d" %\ sysinfo.battery()) elif path == "/exit": go_on = False else: ret[path] = ("text/plain",\ "Unknown resource") msg = ret e32.ao_sleep(5) print "Bye!"
def check_battery_level(): batty = sysinfo.battery() print batty
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sysinfo print "OS: " print sysinfo.os_version() print "SW: " print sysinfo.sw_version() print "IMEI: " print sysinfo.imei() print "Bat: " print sysinfo.battery() print "Net: " print sysinfo.signal() print "Ram: " print sysinfo.total_ram() print "Rom: " print sysinfo.total_rom() print "MaxRamDrive: " print sysinfo.max_ramdrive_size() print "Twips: " print sysinfo.display_twips() print "Pixels: " print sysinfo.display_pixels() print "RamFree: " print sysinfo.free_ram() print "DriveSpace: "
import sysinfo print "Battery level: %d" % sysinfo.battery()
def devInfo(self): all=[(u'IMEI', sysinfo.imei()), (u'Total RAM', str(sysinfo.total_ram()/1024)+'KByte(s)'), (u'Free RAM', str(sysinfo.free_ram()/1024)+'KByte(s)'), (u'Battery', str(sysinfo.battery()*100/7)+u'%')] info='\n'.join(['%s: %s' %(k, v) for k, v in all]) e32.ao_yield() return infopopup(info, u'Phone Info', OKREmpty)
import sysinfo str = "Active Profile: "+ sysinfo.active_profile() str += "\nBattery Info: "+ sysinfo.battery() #battery information in symbian str += "\nDisplay Info: "+ sysinfo.display_pixels() str += "\nFree Space: " + sysinfo.free_drivespace() str += "\nRAM(F/T): " + str(sysinfo.free_ram()/(1024.0*1024.0)) +"/"+ str(sysinfo.total_ram()/(1024.0*1024.0)) str += "\nIMEI: "+ sysinfo.imei()
def test_battery(self): sysinfo.battery()
w=dialog.Wait(u'Speaking...') w.show() audio.say(box.content(id)) w.close() del w else: return None def speak_word(): w=dialog.Wait(u'Speaking...') w.show() audio.say(t.get(t.get_word_info(t.get_pos())[0],t.get_word_info(t.get_pos())[1])) w.close() del w if sysinfo.battery()<=10: if globalui.global_query(u'Battery is low\nSpeak drains battery fast, Continue?')==0: os.abort() pro=sysinfo.active_profile() if pro=='offline' or pro=='silent': if globalui.global_query(u'Phone in '+pro+' profile, Continue?')==0: os.abort() def load(percent=6.25): can.clear((255,255,255)) can.rectangle([(0),(0),(di[0]*percent/100),(di[1])],outline=(200,200,200),fill=(100,100,100),width=3) can.text((di[0]/2-15,di[1]/2+10),str(int(percent)).decode('u8')+u'%',(13,49,102),'title') e32.ao_sleep(0.0000000001) load(6.25) import audio
if (gpson == 0): #initialize GPS initialize_gps() sats = gps_data['satellites']['used_satellites'] print sats, gpson, gps_data['position']['latitude'] if ((sats > 3) and (gps_data['position']['latitude'] != old_lat)): print gps_data['satellites']['used_satellites'], gps_data['position']['latitude'], gps_data['position']['longitude'], gps_data['course']['speed'] #stop GPS #stop_gps() old_lat = gps_data['position']['latitude'] #Get battery data battery = sysinfo.battery() #Get signal strength signal = sysinfo.signal_dbm() #Get time user_time = time.time() count = count + 1 #Print data telem_string = "%d,%d,%f,%f,%.2f,%d,%d,%d" % (count, user_time, gps_data['position']['latitude'], gps_data['position']['longitude'], gps_data['course']['speed'], gps_data['course']['heading'], signal, battery) print telem_string messaging.sms_send('+447748628528', telem_string,'8bit',cb)
def bat(): b = sysinfo.battery() osama.add(((itq('\n\t...................\nBattery level: ') + str(b)) + u'/7\n\t...................\n'))