Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 18:17, 30 April 2008.

How to use the sysagent module

From Forum Nokia Wiki

This article is about how to use the sysagent module in Python

The sysagent module by Cyke64 is very useful in checking various status on the device.

The code for getting status are given below..


#import appuifw module
import appuifw 
#import e32 module
import e32 
#import sysagent and esysagent module
from sysagent import *
from esysagent import *
 
 
def viewsysagent():
 app.body.clear()
 status=current_call()
 if status==ESACallNone:
  text="No call"
# If no call is going on
 
 elif status==ESACallVoice:
  text="Voice call"
# If a Voice call is in progress 
 
 elif status==ESACallFax:
  text="Fax call"
# If a Fax call is in progress
 
 elif status==ESACallData:
  text="Data call"
# If a data call or data packet transfer is active
 
 elif status==ESACallAlerting:
  text="Alerting call"
# If an Alerting call is in progress
 
 elif status==ESACallRinging:
  text="Ringing call"
#If the call is not yet attended and the phone is ringing
 
 elif status==ESACallAlternating:
  text="Alternate call"
#If there is an alternate call
 
 elif status==ESACallDialling:
  text="Dial call"
# If there is a dialed call
 
 elif status==ESACallAnswering:
  text="Answering call"
# # If an answering call is in progress
 
 elif status==ESACallDisconnecting:
  text="Call disconnected"
# If a call is discconnected at the moment
 
 app.body.add(u'%s\n'%text)
# Show text
 
 status = battery_strength()
# For checking battery strength
 
 if status == ESABatteryAlmostEmpty:
  text="Battery almost empty" 
 elif status == ESABatteryLow:
  text="Battery low"
 elif status ==ESABatteryFull:
  text="Battery full"
 app.body.add(u'%s\n'%text)
  
 
 status = phone_status()
# For checking phone status
 
 if status == ESAPhoneOff:
  text="Phone is off"
 
 elif status==ESAPhoneOn:
  text="Phone is on"
 app.body.add(u'%s\n'%text)
# Prints Phone Status
  
 status = SIM_status()
# For Checking SIM Status
 
 if status == ESASimOk:
  text="SIM is ok"
 
 elif status == ESASimNotPresent:
  text="SIM is not present !!!"
 
 elif status == ESASimRejected:
  text="SIM has been rejected !"
 
 app.body.add(u'%s\n'%text)
#Prints SIM Status
 
 status = network_strength()
# For checking network strenght
 
 if status == ESANetworkAvailable:
  text="Network available" 
 
 elif status == ESANetworkUnAvailable:
  text="Network is unavailable !"
 
 else:
  text="Network unknown status" 
 
 app.body.add(u'%s\n | %d'%(text,status))
# Prints the network Status
  
 status = network_status()
# For Checking network Status
 
 if status == ESANetworkStrengthNone:
  text="Network strength none"
 
 elif status == ESANetworkStrengthLow:
  text="Network strength low"
 
 elif status == ESANetworkStrengthMedium:
  text="Network strength medium"
 
 elif status == ESANetworkStrengthHigh:
  text="Network strength high"
 
 elif status == ESANetworkStrengthUnknown:
  text="Network strength unknown"
 
 app.body.add(u'%s\n'%text)
# Prints network Status
 
 status = charger_status()
#Check charger Status..Plugged in, Connected, etc
 
 if status == ESAChargerConnected:
  text="Charger is connected" 
 
 elif status == EESAChargerDisconnected:
  text="Charger is disconnected"
 
 elif status == ESAChargerNotCharging:
  text="Charger is not charging"
 
 else:
  text="Charger unknown status"
 
 app.body.add(u'%s\n'%text)
# Prints Charger Status  
 
 status = data_port()
# Checks status of the data port
 
 if status == ESADataPortIdle: 
  text="Data port idle"
 
 elif status == ESADataPortBusy:
  text="Data port busy"
 
 else:
  text="Data port unknown status" 
 
 app.body.add(u'%s\n | %d'%(text,status))
# Prints status of the data port
 
 status = inbox_status()
# Check Inbox status
 
 if status == ESAInboxEmpty:
  text="Inbox empty"
 
 elif status == ESADocumentsInInbox:
  text="Inbox is not empty"
 
 app.body.add(u'%s\n'%text)
#Prints inbox status
 
 
 status = outbox_status()
# Checks outbox status
 
 if status == ESAOutboxEmpty:
  text="Outbox empty"
 
 elif status == ESADocumentsInOutbox:
  text="Outbox is not empty"
 
 app.body.add(u'%s\n'%text)
#Prints Outbox Status
 
 status = irda_status()
#check IRDA status
 
 if status==ESAIrLoaded:
  text="IRDA Irlap layer loaded"
 
 elif status==ESAIrDiscoveredPeer:
  text=""
 
 
 elif status==ESAIrLostPeer:
  text="IRDA Discovery begin"
 
 elif status==ESAIrConnected:
  text="IRDA Discovery end"
 
 elif status==ESAIrBlocked:	
  text="IRDA Irlap layer blocked"
 
 elif status==ESAIrDisConnected: 
  text="IRDA Irlap layer disconnected"
 
 elif status==ESAIrUnloaded:	
  text="IRDA Irlap layer unloaded"
 
 else:
  text="IRDA unknown status" 
 
 app.body.add(u'%s\n | %d'%(text,status))
#Prints IRDA Status
 
 
 status = clock()
#Checks the Clock Status
 
 if status == ESAAm:
  text="Clock is AM"
 
 elif status == ESAPm:
  text="Clock is PM"
 
 else:
  text="Clock Unknown status"  
 
 app.body.add(u'%s\n | %d'%(text,status))
# Prints Clock Status
 
lock=Ao_lock()
app.body=Text()
app.body.clear()
app.exit_key_handler=lock.signal
app.menu = [(u"View sysagent info",viewsysagent)]
lock.wait()

Download Links:

Sysagent

esysagent

Related Discussions
Thread Thread Starter Forum Replies Last Post
Multi-tasking using the S60 gillyd Python 11 2008-05-08 23:33
3650/7650 Multipoint BT Connection? jukkor Bluetooth Technology 6 2003-11-14 20:07
[announce] feature module for 3rd cyke64 Python 6 2007-02-04 13:54
HCI programming void_pointer Bluetooth Technology 1 2002-12-17 21:43
Nokia 6021 bluetooth SPP and ALPS module JILIX Bluetooth Technology 0 2006-03-31 21:02
 
Powered by MediaWiki