background image

if (inputString.length >= 11)
{

var new_match_string = inputString.substr(11,
inputString.length);
for (var i = 1; i <= 3; i++) {

dmccSet("DVALID.PROG-TARG", i);
dmccSet("DVALID.MATCH-STRING", new_match_
string);

}
// The following DMCC command resets all statistic values
// the CR reset only a view of them
dmccCommand("STATISTICS.RESET");

}
this.send("DEBUG: "+input "\r\n");
return true;

},
onUnexpectedData: function (inputString) {

return true;

},
onTimer: function (inputString) {
}

};
}

Data formatting delegates output to communication handler objects

var comm_handler = new Array(0);

// Converts read data to all upper case. Single code only.
function onResult (decodeResults, readerProperties, output)
{

output.content = '';
output.SetupTool = decodeResults[0].content;
if (decodeResults[0].decoded) {

for (var i = 0; i < comm_handler.length; i++)
{
comm_handler[i].sendResultTelegram(decodeResults);

}

}

}

69

DataMan Application Development

Summary of Contents for DataMan

Page 1: ...DataMan Communications and Programming Guide 2020August13 Revision 6 1 9 1...

Page 2: ...y means electronic or mechanical for any purpose nor transferred to any other media or language without the written permission of Cognex Corporation Copyright 2020 Cognex Corporation All Rights Reserv...

Page 3: ...k 6 Connecting Your DataMan Intelligent Base Station to the Network 10 Direct Connection to Your Computer 11 Connecting Your Reader Across Subnets 16 Troubleshooting a Network Connection 17 DataMan Ap...

Page 4: ...a hazard that could cause death serious personal injury or electrical shock CAUTION This symbol indicates a hazard that could result in property damage Note This symbol indicates additional informatio...

Page 5: ...ol Commands DMCC API The DataMan reader connected to a network can be triggered to acquire images by several methods l using the DataMan Setup Tool l trigger bits l through a DMCC command l manipulati...

Page 6: ...ends the following connection sequence in case of using a PoE injector 1 Connect the PoE injector to the Ethernet network both ends of the patch cable 2 Connect the power cord AC 230V 110V to the PoE...

Page 7: ...ataMan reader via the wireless network as well For this you need to use the Wi Fi slide in with the device Ad hoc Connection The default factory settings for the wireless configuration of the device a...

Page 8: ...ss connection a Authentication only Open Mode can be selected b Encryption method WEP 40 and WEP 104 You can enter a passphrase for these methods Infrastructure Mode You can set Wireless Infrastructur...

Page 9: ...d to encrypt the communication between the Wi Fi Access Point and the reader The following certificates are required l Client s certificate This must be different for each reader It may be publicly ac...

Page 10: ...unencrypted private key and certificate files are allowed l The Client s private key and certificate must contain exactly one section the CA s certificate can contain one or more certificates l Make...

Page 11: ...or power supply at the same time 2 Connect your base station to your PC with an Ethernet cable 3 The base station becomes visible as connected through Ethernet and it routes data through the wireless...

Page 12: ...use and the settings will be copied in the Use Static IP Address window Note Remember to update the IP address of your DataMan device The IP address that is copied belongs to your PC A triangle with a...

Page 13: ...an Setup Tool s Connect page This will force the DataMan Setup Tool to scan for DataMan devices connected to the PC or connected to the same network Configuring the PC to Reside on the Same Subnet as...

Page 14: ...settings can be changed Perform the following steps to configure your PC examples here are of Windows XP 1 In the Start Menu start typing Control Panel and open it 2 Click Network and Internet 3 Clic...

Page 15: ...et Properties window that pops up select Internet Protocol Version 4 TCP IPv4 and click Properties 6 Under the General tab select the Use the following IP address option and enter an IP address and Su...

Page 16: ...button on the DataMan Setup Tool s Connect page The DataMan Setup Tool scans for DataMan devices connected to the PC or connected to the same network Connecting Your Reader Across Subnets The followi...

Page 17: ...network configuration the DataMan Setup Tool may not be able to communicate with the reader and it will not appear in the list of Network devices If you know the IP address of the reader use the Add...

Page 18: ...Tool to assign a different port number as necessary Note Use a third party client such as PuTTY to make changes to the Telnet client provided by Windows to communicate with the DataMan Command Syntax...

Page 19: ...ll be sent from the reader Invalid commands are ignored without feedback Command responses are sent in space delimited ASCII text without a header or footer Extended 1 The reader responds with a heade...

Page 20: ...ach file corresponds to the platform it belongs to PC CF There are two components for each platform one is the DataMan SDK core itself Cognex DataMan SDK the other is for discovering available devices...

Page 21: ...ill appear in the intellisense From this point on you can choose to discover devices either via Ethernet or via serial communication RS232 USB or you can choose to do both 4 Discovering devices via Et...

Page 22: ...es Here is an example where you subscribe for the events of read string and image arrival mySystem XmlResultArrived new XmlResultArrivedHandler OnXmlResultArrived mySystem ImageArrived new ImageArrive...

Page 23: ...for SendCommand which is the command string itself There are also two optional parameters one for overriding the default timeout for the command and another for passing additional bytes with the comm...

Page 24: ...ult components If a result is complete a ComplexResultArrived event is fired If a result is not complete but it times out time out value can be set via the ResultTimeOut property or the ResultCollecto...

Page 25: ...CC commands in scripting it is now possible to evaluate a DMCC command line as full command string It is not required to split the DMCC command into the type correct command arguments Note l The data...

Page 26: ...string argument is required var res dmccGet DEVICE NAME The dmccSend function can be used in a similar way but without splitting the command and type correct arguments var res dmccSend GET DEVICE NAM...

Page 27: ...e currently supported keys key combinations l ALT A to ALT Z l CTRL A to CTRL Z l CTRL F1 to CTRL F12 l SHIFT F1 to SHIFT F12 l F1 to F12 l ALT F1 to ALT F12 l PageUp PageDown Home End Arrow up down l...

Page 28: ...a string argument into base64 encoding The encoded result is returned as a string object Parameter Type Description inputString string Input string to encode into base64 Error Management Scripting err...

Page 29: ...aderProperties ReaderProperties Input the reader properties not tied to the actual decode result output Output Output the object which needs to be updated to modify the output string or raise events T...

Page 30: ...ing in 0 100 For symbologies that use Reed Solomon error correction e g DataMatrix QR Code AztecCode MaxiCode DotCode PDF417 certain 4 state postal codes it reports the UEC unused error correction For...

Page 31: ...exposure is used illEnabled boolean True if internal illumination is enabled illIntensity integer The internal illumination intensity extillEnabled boolean True if external illumination is enabled ex...

Page 32: ...ta check string A Pass Fail assessment determined by the specific application standard selected TruCheckCodeword Property Type Description codeword integer Outputs the codewords associated with the pa...

Page 33: ...to the selected application standard applicationStdNotation string The notes associated with the application standard data parsing asciiArray array of integers The ASCII values for the symbol average...

Page 34: ...ttern in QR code minimumReflectance TruCheckMetric The minimum reflectance minRefl value Modulation TruCheckMetricGradeOnly The modulation MOD value modulationArray TruCheckMetricGradeOnly The array o...

Page 35: ...ion table below dod_uid DoD Validation The details of the DoD Validation property type are listed in the DoD Validation table below GS1Validation GS1 validation details Property Type Description AI00...

Page 36: ...ure trade item Single monetary area AI393n string Amount payable for a variable measure trade item and ISO currency code AI394n string Percentage discount of a coupon AI400 string Customer s purchase...

Page 37: ...004 string Global Individual Asset Identifier GIAI AI8005 string Price per unit of measure AI8006 string Identification of the components of a trade item AI8007 string International Bank Account Numbe...

Page 38: ...the quality of all measured parameters Property Type 1D Standards 2D Standards Description singleScanInt Metric 1D Readability The single scan integrity raw member is set to 1 Single scan integrity i...

Page 39: ...ndicate poor lighting a code which is difficult to read due to similarities between the print and the background or that a printer is performing poorly cellContrast Metric AIM DPM ISO IEC TR 29158 Dat...

Page 40: ...uniformity is a measure of the difference in spacing of grid cells along each axis In the best case this value will be zero indicating that centers of the grid cells are evenly spaced in all directio...

Page 41: ...ow growth As a result a print growth close to zero is desirable A high or low print growth usually indicates problems with the printing process for a code For instance a dot peen marker may be wearing...

Page 42: ...ead due to similarities between the print and the background or that a printer is performing poorly fixedPatternDamage Metric ISO IEC 15415 DataMatrix QR AIM DPM ISO IEC TR 29158 DataMatrix QR The fix...

Page 43: ...ected positions Poor grid non uniformity usually indicates a printing process which is not consistent in its placement of the cells extremeReflectance Metric ISO IEC 15415 DataMatrix QR The extreme re...

Page 44: ...hotspot too much light or that a too high exposure time is being used Print quality troubles like a printer depositing less ink than intended may also be indicated by the minimum reflectance grade edg...

Page 45: ...or dark grayscale levels in the symbol ie noise horizontalMarkGrowth Metric SEMI T10 DataMatrix Horizontal Mark Growth is the tracking of the tendency to over or under mark the symbol that is a horizo...

Page 46: ...Pattern Defects is the ratio of incorrect pixels to total pixels in the finder pattern overallGrade Metric ISO IEC 15416 ISO IEC 15415 DataMatrix QR AIM DPM ISO IEC TR 29158 DataMatrix QR SEMI T10 Ov...

Page 47: ...ity Metric ISO IEC 15416 ISO IEC 15415 DataMatrix QR Contrast Uniformity is an optional parameter that is used for measuring localized contrast variations It does not affect the overall grade reflecta...

Page 48: ...MCC Trigger Describes the details of the initiating trigger event Property Type Description type integer These are the available trigger types l single l presentation l manual l burst l self l continu...

Page 49: ...ype string The name of the output property is the same as the target protocol name If no target specific output is assigned the result falls back to the default result taken from the output content pr...

Page 50: ...Result decodeResults readerProperties output if decodeResults 0 decoded save decoded result to variable var mymsg decodeResults 0 content output to telnet channel a different result output Telnet teln...

Page 51: ...that is being written Pop up messages usually appear when typing special characters for example period opening or closing brackets and so on These messages can also be used manually with the Ctrl Spac...

Page 52: ...nippet Ctrl k and then press x Snippets The editor provides a selection of preset code fragments as examples You can insert these snippets by right clicking in the editor using the toolbar or using th...

Page 53: ...de to send messages back to the other system something that is not supported in basic scripting Advantage The script engine uses the same context for function execution and object creation This allows...

Page 54: ...se keep the value in buffer o onTimer The timer value expired o onUnexpectedData The recieved data is not matching the requirements The boolean return value determines if the data should be removed fr...

Page 55: ...r If encoder ticks should be used instead of distance set the value of the parameter Resolution mm to 1 n distance double The encoder distance in which the onEncoder method will be called The methods...

Page 56: ...dmccCommand TRIGGER true this setTimer 1 0 function replace_crlf input_str return input_str replace r g r replace n g n return onConnect function peerName my_name peerName we may ignore the connection...

Page 57: ...String time today new Date msg today getSeconds 1000 today getMilliseconds else msg unknown command replace_crlf inputString num_send this send my_name msg r n return inputString length onUnexpectedDa...

Page 58: ...ction CommHandler var beat_timer 10 0 beat timer in sec var peer_name return onConnect function peerName peer_name peerName this resetHeartBeat initial timer this expectFramed 0 0 128 some pattern unl...

Page 59: ...tarting Jan 1 1970 as output by date s command Prepend output with real time timestamp communication script var time_offset 0 function CommHandler var peer_name return onConnect function peerName peer...

Page 60: ...col_etx x03 termination VT Parameter to be converted into script configuration constant values Communication Interfaces COM1 Protocol var vt_param_comif_com1_protocol 1 Communication Protocols CMF400...

Page 61: ...Timer _onSync function _onSync if cmf400_status CMF400_PROTOCOL_STATUS SYNCRONIZING this send cmf400_protocol_stx cmf400_gateway_init cmf400_protocol_etx this setTimer 1 0 onTimer _onSync function _on...

Page 62: ..._ profibus_node_number 3 msg M zero_prefix vt_param_ profibus_mode 3 msg cmf400_protocol_etx this send msg this onTimer _configTimedOut this setTimer 10 0 if data cmf400_gateway_error cmf400_status CM...

Page 63: ...ion CommHandler private properties and methods var num_trigger 0 var my_name var num_send 99 function privFunc public properties and methods return onConnect function peerName my_name peerName num_sen...

Page 64: ...1 dmccSet SYMBOL POSTNET 1 function CommHandler var tray 0000 var speed 0 var package_id_expr new RegExp I 0 9 9 var package_idtray_expr new RegExp I 0 9 9 T 0 9 4 var config_msg_expr new RegExp CS 0...

Page 65: ...decodeResults onDisconnect function bConnected false onExpectedData function input var input input replace n g switch input charAt 0 toUpperCase case B dmccCommand TRIGGER true break case E dmccComman...

Page 66: ...se not used break return true onUnexpectedData function input return true The data formatting formats the result based on global variables set by the communication handler var packageID 000000000 rese...

Page 67: ...if decodeResults i decoded continue switch decodeResults i symbology name case Interleaved 2 of 5 b throw away 6 digit I2of5 ending in 9 if mode b decodeResults i content length 6 decodeResults i con...

Page 68: ...e_base64 my_decode_results i content break case POSTNET case PLANET case XYZ OneCode case Interleaved 2 of 5 default msg my_decode_results i content packageID 000000000 reset the package id output Tel...

Page 69: ...nputString r n return true onUnexpectedData function inputString return true onTimer function inputString Data formatting delegates output to communication handler objects var comm_handler new Array 0...

Page 70: ...name Wait For Content CHECKSUM value 1 name Header Received var errorCodes undef_index 0x31 multi_index 0x32 index_in_use 0x33 telegram_error 0x34 trigger_overrun 0x40 buffer_overflow 0x41 var filler...

Page 71: ...ksum data this sendTelegram type system_id content data index null invalidate the used index sendErrorTelegram function errcode var errtel type F content system_id String fromCharCode errcode this sen...

Page 72: ...med x02 x03 203 this setTimer heartbeat_time_s index null comm_handler push this all_index new Array return true onDisconnect function var index comm_handler indexOf this comm_handler splice index 1 o...

Page 73: ...nt Available events identifier are defined in a constant object named Callback Optional arguments can be used to configure the event e g to filter the sensitivity A handle is returned that must be use...

Page 74: ...0 signal and the switch button l onInput1 reacting on input1 signal l onTrigger reacting on trigger events function CommHandler return onConnect function peerName this peer peerName this input1 regist...

Page 75: ...COM1 inputs 0 call onTrigger start trigger with index 10 NO READ call onTrigger end trigger with index 10 call onInput0 for COM1 inputs 4096 call onTrigger start trigger with index 11 call onInput0 fo...

Page 76: ...Copyright 2020 Cognex Corporation All Rights Reserved...

Reviews: