Zentitle SDK and Library
Files | Functions
Python Nalpeiron V10 Analytics library (NSA) functions

Files

file  cnsa.py
 Nalpeiron V10 Nalpeiron library licensing (NSA) functions.
 

Functions

def cnsa.NSADefineFunctions (libHandle)
 Define the Analytics library (NSA) functions from the C library. More...
 
def cnsa.pyNSAAppStart (username, nsaClientData, transID)
 Records startup of your application. More...
 
def cnsa.pyNSAAppStop (username, nsaClientData, transID)
 Records the shutdown of your application. More...
 
def cnsa.pyNSAException (username, exceptionCode, description, nsaClientData, transID)
 Records an error of type exceptionCode by username with details in description. More...
 
def cnsa.pyNSAFeatureStart (username, featureCode, nsaClientData, transID)
 Records the start of a feature specified by featureCode and used by username. More...
 
def cnsa.pyNSAFeatureStop (username, featureCode, nsaClientData, transID)
 Records the end of use of a feature specified by featureCode and used by username. More...
 
def cnsa.pyNSAGetComputerID ()
 Gets the computer ID of the current system. More...
 
def cnsa.pyNSAGetHostName ()
 Gets the name of the SOAP server the library contacts for licensing information. More...
 
def cnsa.pyNSACheckCache ()
 Retrieves the current cache file size in bytes. More...
 
def cnsa.pyNSAGetPrivacy ()
 Checks the current privacy setting. More...
 
def cnsa.pyNSAGetStats ()
 Returns status information from the NSA library. More...
 
def cnsa.pyNSAGetVersion ()
 Gets the version of the NSA library being accessed. More...
 
def cnsa.pyNSALogin (username, nsaClientData, transID)
 Records login of username. More...
 
def cnsa.pyNSALogout (username, nsaClientData, transID)
 Records logout of username. More...
 
def cnsa.pyNSASendCache (username, transID)
 If a cache file of analytics data exists on the end user's system send it to Nalpeiron. More...
 
def cnsa.pyNSASetPrivacy (privacySetting)
 Sets the library's privacy setting to nsaPriv. More...
 
def cnsa.pyNSASysInfo (username, applang, version, edition, build, licenseStatus, nsaClientData, transID)
 Sends information about the end user's system to Nalpeiron. More...
 
def cnsa.pyNSATestConnection2 (nsaClientData, transID)
 Tests the network connection to Nalpeiron. More...
 
def cnsa.pyNSAValidateLibrary (custID, prodID)
 Verifies that the shared library you are accessing is the library you stamped at Nalpeiron's website. More...
 

Detailed Description

Function Documentation

def cnsa.NSADefineFunctions (   libHandle)

Define the Analytics library (NSA) functions from the C library.

Parameters
libHandlea library handle as returned by cytpes.cdll.LoadLibrary
Returns
def cnsa.pyNSAAppStart (   username,
  nsaClientData,
  transID 
)

Records startup of your application.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSAAppStop (   username,
  nsaClientData,
  transID 
)

Records the shutdown of your application.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSACheckCache ( )

Retrieves the current cache file size in bytes.

Returns
Tuple retVal, cachesize
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
cachesize.value = a unsigned 64 bit int containing the size of the cache in bytes.
def cnsa.pyNSAException (   username,
  exceptionCode,
  description,
  nsaClientData,
  transID 
)

Records an error of type exceptionCode by username with details in description.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
exceptionCodea NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
descriptiona NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSAFeatureStart (   username,
  featureCode,
  nsaClientData,
  transID 
)

Records the start of a feature specified by featureCode and used by username.

Parameters
featureCodea NULL terminated, UTF-8 encoded string containing the five (5) character feature code of the feature to be checked out.
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSAFeatureStop (   username,
  featureCode,
  nsaClientData,
  transID 
)

Records the end of use of a feature specified by featureCode and used by username.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
featureCodea NULL terminated, UTF-8 encoded string containing the five (5) character feature code of the feature to be checked out.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSAGetComputerID ( )

Gets the computer ID of the current system.

Returns
Tuple retVal, computerID
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
computerID = "" on error
computerID = string containing the computer ID
def cnsa.pyNSAGetHostName ( )

Gets the name of the SOAP server the library contacts for licensing information.

Returns
Tuple retVal, hostname
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
hostname = "" on error
hostname = string containing the hostname of licensing server
def cnsa.pyNSAGetPrivacy ( )

Checks the current privacy setting.

If privacy is unset, the privacy setting used by the library will be the one stamped into it.

Returns
= 0 No privacy
= 1 Privacy enabled.
< 0 A negative error value is returned (Nalpeiron V10 error returns)
def cnsa.pyNSAGetStats ( )

Returns status information from the NSA library.

Returns
Tuple retVal, nsaStats
= 0 If the call succeeded
< 0 A negative error value is returned (Nalpeiron V10 error returns)
nsaStats statistics from the NSA library as a NULL terminated, UTF-8, XML string. The format of the return is:
   <?xml version="1.0" encoding="UTF-8"?>
       <NSA Current Statistics>
           <OfflineMode>0</OfflineMode>
           <LocationInfo>1</LocationInfo>
           <Cache Thread>
               <Max Cache Que Len>25</Max Cache Que Len>
               <Current Cache Que Len>0</Current Cache Que Len>
               <Cache writes>1</Cache writes>
               <Cache fails>0</Cache fails>
           </Cache Thread>
           <Soap Pool>
               <Min Soap Threads>10</Min Soap Threads>
               <Max Soap Threads>10</Max Soap Threads>
               <Queued Jobs>0</Queued Jobs>
               <Running Jobs>0</Running Jobs>
               <Finished Jobs>145</Finished Jobs>
           </Soap Pool>
       </NSA Current Statistics>
def cnsa.pyNSAGetVersion ( )

Gets the version of the NSA library being accessed.

Returns
Tuple retVal, version
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
version = "" on error
version = string containing the library version on success
def cnsa.pyNSALogin (   username,
  nsaClientData,
  transID 
)

Records login of username.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSALogout (   username,
  nsaClientData,
  transID 
)

Records logout of username.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSASendCache (   username,
  transID 
)

If a cache file of analytics data exists on the end user's system send it to Nalpeiron.

Cache files are created when a system is offline or has been placed in offline mode.

Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSASetPrivacy (   privacySetting)

Sets the library's privacy setting to nsaPriv.

Parameters
privacySettingprivacy value for the library. Possible values for setting are 0 "no privacy" or 1 "privacy enabled".
Returns
= 0 If the call succeeded
< 0 A negative error value is returned (Nalpeiron V10 error returns)
def cnsa.pyNSASysInfo (   username,
  applang,
  version,
  edition,
  build,
  licenseStatus,
  nsaClientData,
  transID 
)

Sends information about the end user's system to Nalpeiron.

In addtion to the parameters the function will send the following information

   date            date and time
   username        username as passed into NSASysInfo
   productid       your product ID
   customerid      your customer ID
   computerid      the end user's computer ID
   NSA version     version number of the NSA Library
   location        countryid- Two character country code
   country         country name
   region          state, territory, region as appropriate
   city            city
   zipcode         zipcode as appropriate
   operatingsystem OS (Linux, Windows, OSX, etc)
   bitage          32 or 64
   screenresx      screen width
   screenresy      screen heigth
   proc            processor information
   cores           number of processors or cores
   memory          amount of memory in Meg.
   oslanguage      default OS language
   applanguage     passed in app language
   productstatus   passed in License Status
   profile         type of system(laptop or desktop)
Parameters
usernamea NULL terminated, UTF-8 encoded username that will be passed to the Nalpeiron server or daemon with your call.
applanga NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
versiona NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
editiona NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
builda NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
licenseStatusa NULL terminated, UTF-8 encoded string that will be passed to the Nalpeiron server or daemon with your call.
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
Tuple retVal, tid
retVal = 0 If the call succeeded
retVal < 0 A negative error value is returned (Nalpeiron V10 error returns)
tid.value = unsigned 32 bit integer containing the transactionID
def cnsa.pyNSATestConnection2 (   nsaClientData,
  transID 
)

Tests the network connection to Nalpeiron.

Parameters
nsaClientDataa NULL terminated, UTF-8 encoded XML fragment containing whatever data you would like to pass to the Nalpeiron server or daemon with your call.
transIDtransID allows a series of transactions to be grouped together with a transaction ID. To retrieve a transaction ID from any function, set transID = 0 and call the function. Upon return, transID will be set with a random number that will be passed to the Nalpeiron server to identify the transaction. Send this value into any functions that are to be grouped together. This is particularly useful for function pairs such as NSALogin/NSALogout, NSAAppStart/NSAAppStop, NSAFeatureStart/NSAFeatureEnd, etc. If you do not wish to use the transaction ID a NULL pointer will disable it.
Returns
= 0 If the call succeeded
< 0 A negative error value is returned (Nalpeiron V10 error returns)
def cnsa.pyNSAValidateLibrary (   custID,
  prodID 
)

Verifies that the shared library you are accessing is the library you stamped at Nalpeiron's website.

It does this by checking the customerID and productID sent in against the stamped values. Any negative return value, even if it is not a known error code, is cause to consider the library invalid.

Parameters
custIDa unsigned 32 bit integer containing your Nalpeiron customer ID. NOTE the library uses ONLY the last 5 non-zero digits of your full customer ID. That is, if your customer ID is 12340005678 then the customer ID used in conjuction with the library would be 5678.
prodIDa unsigned 32 bit integer containing your Nalpeiron product ID. NOTE the library uses ONLY the last 5 non-zero digits of your full product ID. That is, if your customer ID is 12340005678 then the product ID used in conjuction with the library would be 5678.
Returns
= 0(zero) is returned if the customerID/productID passed into the function match those from the library. On mismatch, a negative error value is returned.
< 0 On mismatch, a negative error value is returned (Nalpeiron V10 error returns)