How to prevent data sending over Infrared programatically
Article Metadata
Code Example
Article
Contents |
Introduction
With Symbian devices, we can send data over Infrared. But if device management want to configure devices in such a way so that Infrared can't be used in company devices for some security reason. How we can stop Infrared from being used? In this article, we are examining how we can prevent Infrared being used programmatically.
When user selects send menu then a sub menu is displayed like send via infrared. One menu item corresponds to a Mtm plug in module that is present in the system. For example, if there is Infrared module is present in the system, then it displays the send via infrared menu item. If Infrared module is not present in the system, it will not show the menu item. During runtime if device management software want to prevent for example sending option for a particular bearer, then this solution can be used.
Solution
When the device management software want to remove the option then it can call DeInstallMtmGroup with the Mtm resource file. Once the Mtm is uninstalled then send ui will not find the Mtm and as result the menu item will not be shown. When we want to restore the option then we call InstallMtmGroup again.
Code for removing Infrared send via menu item.
// English language, check for other language
_LIT(KMTMDataLocation,"z:\\resource\\messaging\\mtm\\irmtm.r01");
CMsvSession* session = CMsvSession::OpenSyncL(*this);
CleanupStack::PushL(session);
TInt err=session->DeInstallMtmGroup(KMTMDataLocation);
if (err!=KErrNone && err!=KErrNotFound)
{
User::Leave(err);
}
CleanupStack::PopAndDestroy(session); // session
Code for re storing Infrared send via menu item.
// English language r01, check for other language
_LIT(KMTMDataLocation,"z:\\resource\\messaging\\mtm\\irmtm.r01");
CMsvSession* session = CMsvSession::OpenSyncL(*this);
CleanupStack::PushL(session);
TInt err=session->InstallMtmGroup(KMTMDataLocation);
if (err!=KErrNone && err!=KErrNotFound)
{
User::Leave(err);
}
CleanupStack::PopAndDestroy(session); // session
Required Capability
WriteDeviceData is necessary to execute DeInstallMtmGroup() method. Since we are calling the method on irmtm.01, only the IRDA menu item is removed from send via.
Code example
This code was tested with E90 (S60 3.1 platform) Example code be found from following link: File:IRSendMenuOnOff.zip
How to block IP packet with IPhook module based on IP address
How to prevent data sending over Infrared programatically
Removing send via Bluetooth from send menu
How to prevent web browsing with WLAN programatically


(no comments yet)