phpDocumentor ModuleWriting
[ class tree: ModuleWriting ] [ index: ModuleWriting ] [ all elements ]

Class: Device_TestModule

Source Location: /devices/test_module/TestModule.php

Class Device_TestModule

Class Overview

This is the main implementation class of the module

The name of the class must the the 'Device_' followed by the name of the module file (without the '.php' extension), so in this case the file is "TestModule.php" and the class is Device_TestModule.

The class MUST define the constructor method and one additional public method: writeInstaller().

All other methods and properties should be private. This example sets zipInstaller method to protected, so that it can be seen in the documentation.

It is important to understand how the device module fits into the whole picture, so here is s short descrption. An external caller (for instance GUI::generateInstaller()) creates the module device instance and prepares its environment for a given user profile by calling DeviceConfig::setup() method. this will:

  • create the temporary directory and save its path as $this->FPATH
  • process the CA certificates and store results in $this->attributes['internal:CAs'][0] $this->attributes['internal:CAs'][0] is an array of processed CA certificates a processed certifincate is an array 'pem' points to pem feromat certificate 'der' points to der format certificate 'md5' points to md5 fingerprint 'sha1' points to sha1 fingerprint 'name' points to the certificate subject
  • save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
Finally, the module DeviceConfig::writeInstaller is called and the returned path name is used for user download.

Located in /devices/test_module/TestModule.php [line 65]

DeviceConfig
   |
   --Device_TestModule
Author(s): Information Tags:

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From DeviceConfig

DeviceConfig::$attributes
DeviceConfig::$FPATH
DeviceConfig::$lang_index
DeviceConfig::$module_path
DeviceConfig::$selected_eap
DeviceConfig::$sign

Inherited From DeviceConfig

DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one
DeviceConfig::copyFile()
Copy a file from the module location to the temporary directory.
DeviceConfig::dumpAttibutes()
dumps attributes for debugging purposes
DeviceConfig::getPreferredEapType()
select the preferred eap method
DeviceConfig::saveCertificateFiles()
Save certificate files in either DER or PEM format
DeviceConfig::setup()
Set up working environment for a device module
DeviceConfig::translateFile()
Copy a file from the module location to the temporary directory aplying translation.
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]
Method Summary
Device_TestModule   __construct()   Constructs a Device object.
string   writeInstaller()   prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

[ Top ]
Methods
Constructor __construct  [line 77]

  Device_TestModule __construct( string $device  )

Constructs a Device object.

It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods available for the particular device.

  1. function __construct({
  2.       $this->supportedEapMethods  array(EAP::$TLSEAP::$PEAP_MSCHAP2EAP::$TTLS_PAP);
  3.       debug(4,"This device supports the following EAP methods: ");
  4.       debug(4,$this->supportedEapMethods);
  5.     }

Parameters:
string   $device:  a pointer to a device module, which must be an index of one of the devices defined in the Devices array in devices.php.

API Tags:
Access:  public

Information Tags:
Final:  not to be redefined

Redefinition of:
DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one

[ Top ]
writeInstaller  [line 89]

  string writeInstaller( )

prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

  1. function writeInstaller({
  2. debug(4,"Test Module Installer start\n");
  3.    // create certificate files and save their names in $CA_files arrary
  4.      $CA_files $this->saveCertificateFiles('der');
  5.   
  6.     // copy a fixed file from the module Files directory
  7.        if($this->copyFile('Module.howto'))
  8.           debug(2"copying of Module.howto failed\n");
  9.  
  10.     // copy a fixed file from the module Files directory and saveunde a different name
  11.        if$this->copyFile('test_file','copied_test_file'))
  12.           debug(2"copying of Module.howto to copied_test_file failed\n");
  13.        $this->dumpAttibutes('profile_attributes');
  14.        $installer_path =  $this->zipInstaller($this->attributes);
  15.        return($installer_path);
  16.    }


API Tags:
Return:  installer path name
Access:  public


Redefinition of:
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]

Documentation generated on Thu, 13 Oct 2011 08:42:11 +0200 by phpDocumentor 1.4.3