• No results found

Built-in User-defined Functions

In document USER GUIDE Tems Discovery Device 10.0 (Page 188-200)

6. Save the results by either right-clicking on the floor print and selecting Save from the content menu, or closing the Map View and confirming the Save

5.1 Script Builder

5.1.6 Built-in User-defined Functions

5.1.6.1 ClearAllEvents:

Clear all events in the specified message index.

Syntax:

void ClearAllEvents(object oMessageIndex) oMessageIndex: message index

Example:

ClearAllEvents(MESSAGE_INDEX-2);

5.1.6.2 ClearEvent:

Remove a specific event in the specified message index.

Syntax:

void ClearEvent(object oMessageIndex, object oEventType) oMessageIndex: message index

oEventType: event type to be removed

Example:

ClearEvent(MESSAGE_INDEX-2, EVENT.Drop_Call);

Where:

Call_Drop is a user-defined event in the spreadsheet.

5.1.6.3 ReplaceEvent:

Replace a specific event in the specified message index with another event.

Syntax:

void ReplaceEvent(object oMessageIndex, object oOrigEventType, object oNewEventType)

oMessageIndex: message index

oOrigEventType: event type to be replaced oNewEventType: new event type

Example:

//replace EVENT.Drop_Call with EVENT.Call_Release ReplaceEvent(MESSAGE_INDEX-2, EVENT.Drop_Call, EVENT.Call_Release);

Where:

Call_Drop and Call_Release are user-defined events in the spreadsheet.

180  Tools

5.1.6.4 AddEvent:

Add a specific event in the specified message index.

Syntax:

void AddEvent(object oMessageIndex, object oEventType) oMessageIndex: message index

oEventType: event type to add

Example:

//Add EVENT.Drop_Call

AddEvent(MESSAGE_INDEX-2, EVENT.Drop_Call);

Where:

Call_Drop is a user-defined event in the spreadsheet.

5.1.6.5 AssignMetricValue:

Assign a value to a specific metric in the specified message index.

Syntax:

void AssignMetricValue(object oMessageIndex, string szMetricName, object oValue)

oMessageIndex: message index szMetricName: target metric name oValue: value to assign

Example:

AssignMetricValue(MESSAGE_INDEX-2, Metric_EcIo, -10);

Where:

Metric_EcIo is a user-defined metric in the spreadsheet.

5.1.6.6 ReplaceMetricValue:

Replace the value of a specific metric within a certain message range from one to another.

Syntax:

bool ReplaceMetricValue(object oStartIndex, object oEndIndex, string szMetricName, object oValueOrig, object oValueNew) oStartIndex: start index of the message range

oEndIndex: start index of the message range szMetricName: target metric name

oValueOrig: original metric value oValueNew: new metric value

return true if metric valus has been successfully replaced, otherwise, return false.

Example:

AssignMetricValue(MESSAGE_INDEX-2, Metric_EcIo, -10);

Where:

Metric_EcIo is a user-defined metric in the spreadsheet.

5.1.6.7 GetLatLon:

Get the geo position at the specfied timestamp.

Syntax:

void GetLatLon(object oTimestampInMs, out double dLat, out double dLon)

oTimestampInMs: timestamp dLat: latitude

dLon: longitude

Example:

double dLat, dLon;

GetLatLon(TIMESTAMP, out dLat, out dLon);

182  Tools

5.1.6.8 IsValueValidStatic:

Check whether a value is valid.

Syntax:

bool IsValueValidStatic(object oVal) oVal: value to check

return true if the value is valid, otherwise, return false;

Example:

Check whether a value is valid.

Syntax:

bool IsValueValid(object oVal) oVal: value to check

return true if the value is valid, otherwise, return false;

Example:

Get the value of a specified device attribute.

Syntax:

string GetDeviceAttribute(string szAttribute) szAttribute: name of device attribute

return value of the specified device attribute Example:

string szIMEI = GetDeviceAttribute("IMEI");

5.1.6.11 SetDeviceAttribute:

Set the value of a specified device attribute.

Syntax:

void SetDeviceAttribute(string szAttribute, string szValue) szAttribute: name of device attribute

szValue: value of the device attribute

Example:

SetDeviceAttribute("Operator", "TEMS");

5.1.6.12 GetWcdmaUarfcnIndex:

Get the index of a specified UARFCN.

Syntax:

int GetWcdmaUarfcnIndex(object oUARFCN) oUARFCN: UARFCN

return index of the specified UARFCN

Example:

int iIndex = GetWcdmaUarfcnIndex(4085);

Remarks:

Each WCDMA UARFCN will be assigned a unique integer automatically by TEMS Discovery during data import.

5.1.6.13 ElementNotContain:

Return elements in an array list that do not exist in another array list.

Syntax:

string ElementNotContain(ArrayList sourceList, ArrayList targetList)

sourceList: array list targetList: array list

return a comma delimited string that represents the elements of array list sourceList which do not exist in array list

targetList.

Example:

string szMissing = ElementNotContain(sourceList, targetList);

184  Tools

5.1.6.14 ElementMissing:

Return elements in an array list that do not exist in another array list.

Syntax:

ArrayList ElementMissing(ArrayList sourceList, ArrayList targetList)

sourceList: array list targetList: array list

return array list that represents the elements of array list sourceList which do not exist in array list targetList.

Example:

ArrayList alMissing = ElementMissing(sourceList, targetList);

5.1.6.15 FindPairValue:

Find index of a given value in a specified array list; then return the value of the element in the same index of another array list.

Syntax:

float FindPairValue(float key, ArrayList sourceList, ArrayList targetList)

float: the value of element in sourceList sourceList: array list

targetList: array list

return the paired value of the element in another array list.

Example:

float fEcIo = FindPairValue(218, alPSCList, alEcIoList)

5.1.6.16 MaxOfArrayList:

Find the maximum value of the specified array list.

Syntax:

float MaxOfArrayList(ArrayList al) al: array list

return the maximum value of the specified array list

5.1.6.17 CountOfArrayList:

Find the count of the specified array list.

Syntax:

int CountOfArrayList(ArrayList al) al: array list

return the count of the specified array list

5.1.6.18 IsIdentical:

Check whether two array lists are exactly identical, including their sequences of elements.

Syntax:

bool IsIdentical(ArrayList al1, ArrayList al2) al1: array list

al2: array list

return true if two array lists are identical, otherwise, return false

5.1.6.19 IsIdenticalIgnoreOrder:

Check whether two array lists are identical, ignoring the sequence of elements.

Syntax:

bool IsIdenticalIgnoreOrder(ArrayList al1, ArrayList al2) al1: array list

al2: array list

return true if two array lists are identical, otherwise, return false

5.1.6.20 IsIdenticalFloatArray:

Check whether two float array lists are exactly indentical, including their sequence.

Syntax:

bool IsIdenticalFloatArray(ArrayList al1, ArrayList al2) al1: float array list

al2: float array list

return true if two array lists are identical, otherwise, return false

186  Tools

5.1.6.21 GetDisplayString:

Get a string representation of the specified array list. Elements of the specified array list will be concatenated and delimited with commas.

Syntax:

string GetDisplayString(ArrayList alValue) alValue: array list

5.1.6.22 ArrayListContains:

Check whether an array list contains the specified value.

Syntax:

bool ArrayListContains(ArrayList arrData, object targetVal) arrData: array list

Get the index of the specified value in an array list.

Syntax:

int ArrayListIndexOf(ArrayList arrData, object targetVal) arrData: array list

targetVal: target value

Example:

int index = ArrayListIndexOf(alPSCList, 218);

5.1.6.24 SameMemberInt:

Check whether two integer array lists are indentical, ignoring their sequences.

Syntax:

bool SameMemberInt(ArrayList al1, ArrayList al2) al1: integer array list

al2: integer array list

return true if two array lists are identical, otherwise, return false

5.1.6.25 ConvertToInt:

Convert a float array list to an integer array list.

Syntax:

ArrayList ConvertToInt(ArrayList alFloat) alFloat: float array list

return integer array list.

5.1.6.26 ConvertToDateString:

Convert a timestamp (in milliseconds) to date string such as MM/dd/YYYY.

Syntax:

string ConvertToDateString(object oTimestampIsMs) oTimestampIsMs: time stamp in millisecond return date string.

Example:

string szDate = ConvertToDateString(TIMESTAMP);

5.1.6.27 ConvertToTimeString:

Convert a timestamp (in milliseconds) to a time string such as HH:mm:ss.fff.

Syntax:

string ConvertToTimeString(object oTimestampIsMs) oTimestampIsMs: time stamp is millisecond return time string.

Example:

string szTime = ConvertToTimeString(TIMESTAMP);

188  Tools

5.1.6.28 ConvertToDateTimeString:

Convert a timestamp (in milliseconds) to a date time string such as MM/dd/YYYY HH:mm:ss.fff.

Syntax:

string ConvertToDateTimeString(object oTimestampIsMs) oTimestampIsMs: time stamp is millisecond

return date time string.

Example:

string szDateTime = ConvertToDateTimeString(TIMESTAMP);

5.1.6.29 ExtractNumericValue:

Extract a numeric value from a string that contains numbers.

Syntax:

float ExtractNumericValue(string szString) szString: a string that contains numbers return float value.

Example:

float fVal = ExtractNumericValue(""Call Duration: 300.5 ms"");

fVal will be 300.5.

5.1.6.30 GetSectorParameter:

Get a sector parameter value.

Syntax:

string GetSectorParameter(string szSiteId, string szSectorId, string szTech, string szParmName)

szSiteId: site ID szSectorId: sector ID

szTech: technology flag (available flags: CDMA, EVDO, GSM, WCDMA, TD, LTE)

szParmName: sector parameter name

return the value of the specified sector parameter.

Syntax of overloading function:

string GetSectorParameter(string szSector_SiteId, string szTech, string szParmName)

szSector_SiteId: contains sector and site id in the format of

"<sectorID> [[<SiteID>]"

szTech: technology flag (available flags: CDMA, EVDO, GSM, WCDMA, TD, LTE)

szParmName: sector parameter name

return the value of the specified sector parameter.

Example:

string szAngle = GetSectorParameter(SiteID,SectorID,"",

"Azimuth");

string szLtePCI= GetSectorParameter(SiteID, SectorID, "LTE",

"PCI");

string szLtePCI= GetSectorParameter(Sector_SiteID, "LTE",

"PCI");

Where:

SiteID is alias of [!Mid].[Common].[Cell ID - LTE].[Site ID].[Sort By: Signal Strength].[Top #1] defined in Alias spreadsheet

SectorID is alias of [!Mid].[Common].[Cell ID - LTE].[Sector ID].[Sort By: Signal Strength].[Top #1] defined in Alias spreadsheet

Sector_SiteID is alias of [!Mid].[Common].[Cell ID - LTE].[Serving Sector] defined in Alias spreadsheet

190  Tools

5.1.6.31 GetSectorParameters:

Get sector parameter value by passing the sector keys and the geo location of sector detected.

Syntax:

string[] GetSectorParameters(string szKey1, string szKey2, string szTech, double dLatitude, double dLongitude, string[]

arrParmName)

szKey1: first key of the sector. It is PN for CDMA and EVDO, BSIC for GSM, PSC for WCDMA, CPI for TD, and PCI for LTE.

szKey2: second key of the sector. It is BCCH for

GSM,UARFCN for WCDMA and TD, and EARFCN for LTE. Pass ""null""

(DON'T include quotation marks) if this key is unknown.

szTech: technology flag (available flags: CDMA, EVDO, GSM, WCDMA, TD, LTE)

dLatitude: latitude of the sector detected.

dLongitude: longitude of the sector detected.

arrParmName: list of sector parameter names

return the list of value corresponding to the specified list of sector parameters.

string[] arrResults = GetSectorParameters(Psc.ToString(), szUarfcn, "WCDMA", dLat, dLon,

new string[]{"Latitude", "Longitude", "Azimuth",

"Antenna_Type"});

double dSectorLat, dSectorLon;

int iSectorAzimuth;

bool bSectorLocationOK = false;

if(double.TryParse(arrResults[0], out dSectorLat) &&

double.TryParse(arrResults[1], out dSectorLon)) bSectorLocationOK = true;

int.TryParse(arrResults[2], out iSectorAzimuth);

string szAntennaType = arrResults[3];

}

Where:

Psc is alias of [!M].[WCDMA].[WCDMA Cell Measurements].[Categorized PSC:A1]

Uarfen is alias of [!M].[WCDMA].[WCDMA Cell Measurements].[Categorized UARFCN_DL:A1]

dLat is the alias of [!M].[Common].[GPS Position].[Latitude]

dLon is the alias of [!M].[Common].[GPS Position].[Longitude]

In document USER GUIDE Tems Discovery Device 10.0 (Page 188-200)