intouch machine edition (v2.2.x) - cognex
TRANSCRIPT
![Page 1: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/1.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 1/28
InTouchMachineEdition(v2.2.x)
Introduct ion
InthiswikipageswewillexplainhowtouseourcmbSDKtroughcordovapluginascustomwidgetinITMEproject
Gett ingStarted
OpenITMEStudioandcreatenewproject
![Page 2: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/2.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 2/28
Setyourprojectresolution
![Page 3: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/3.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 3/28
Project Tags
GoinGlobalsectionofProjectExplorer,openProjectTags->DatasheetViewandinsertprojecttagsthatwewilluse.Wewillexplaineverytaglaterinthissection
![Page 4: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/4.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 4/28
Alltagsarelocalandchangetothetagvalueaffectsonlythestationonwhichthechangewasmade.
BarcodeWidget
Howthiswidgetisworking?Thereistriggerpropertiesthatcallapimethodsfromcordovaplugin.Thereisoutputpropertieswherewereturnresultsfromapimethodsandthereiseventslikecallbackfunctionsthatarecalledwhenapimethodisexecuted.Onthislinkyoucanreadabouteverypropertyandhereaboutevents.
Project screens
![Page 5: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/5.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 5/28
GobackinGraphicssection,rightclickonScreenscategoryandclickInsert
SetscreenattributesandpressOK.
![Page 6: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/6.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 6/28
Designyourheaderscreenandnameitasheader.
Herewehaveheadertext,labelwherewewillshowreaderdevicebatterylevelandsmartmessageobjectthatshowcurrentreaderdeviceconnectionstatus.
InheaderscreenwewilladdourbarcodeReadercustomwidget.
ClickonCustomWidgeticon
![Page 7: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/7.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 7/28
ClickimportandfindyourbarcodeReader.cwpfile .barcodeReadershouldbeshownasavailablewidget.SelectitandclickOK.
barcodeReadercustomwidgetisaddedinheaderscreen
OpenbarcodeReaderpropertiesandgoinwidgetmembers
![Page 8: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/8.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 8/28
![Page 9: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/9.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 9/28
MappropertiesfromcustomwidgetwithprojecttagsandsetactionSet+Getandsetscriptthatyouwanttoexecuteincallbackevents.
ThenopenheaderscreenscriptandcallsetPreviewContainerPositionAndSizeEventTriggerandloadScannermethodswhenheaderscreenisopened.Alsoopenanotherscreen(main)whilethisoneisopening.
![Page 10: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/10.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 10/28
Nowcreateanotherscreenandnameitmain.
![Page 11: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/11.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 11/28
Inthisscreenwehaverectanglewherewedisplayscannedresults,buttontostart/stopscanningandbuttontocleardisplayedresults.
![Page 12: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/12.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 12/28
LaterrightclickonScreenGroupcategoryandcreateStartUpscreengroup.
![Page 13: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/13.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 13/28
OpenProjectpropertiesandsetthisgroupasStartupscreen.
BecausewewanttodeploythisapplicationasHTMLwebinterfaceandinteractfrommobiledevicesweneedtoopenMobileAccessmenuatleastonesandsavechangesonclose.Also,forbettercommunicationwithcustomwidget,setProcessValuesatminimumvaluewhichis100.
![Page 14: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/14.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 14/28
WhenwefinishwithourscreensandconfigurationsVerifyproject.
andSaveallscreensasHTMLforwebaccess
![Page 15: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/15.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 15/28
WithallthesestepswefinishedourITMEproject.
Serverconfigurat ion
NavigatetoyourITMEwebapplicationphysicalpath.IfyouuselocalIISserverusuallythispathisC:\inetpub\wwwroot\ITME81andcopybarcodeReaderServerFilesthatyou'vedownload.
![Page 16: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/16.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 16/28
Thesecordovafilesthatwillbehostedonserverwillhelpustousenativefeaturestroughcustomwidgets.Lateropenindex.htmlandreferencethesescripts:
WhenwenavigatetoserverURLweaddplatformthatweareusingasattributeinquerystring.
WithbarcodeReader.jswecheckthisattributetoknowwhichcordovafilestoload(iOSor
![Page 17: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/17.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 17/28
android).
NowopenIISmanagerrightclickonyourITME81applicationandclickAddVirtualDirectory:
Set“CustomWidget”asAliasandasphysicalpatsetpathtoyourITMEproject(C:\Users\Marko\Documents\InTouchMachineEditionv8.1Projects\cmbSdkSampleinourcase)
Besurethatyoumakeconnectionwithuserthathaveauthorizationtoselectedpath.
![Page 18: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/18.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 18/28
CognexWrapperApplicat ion
RunCognexWrapperApplicationonyourmobiledevice.InServerURLinputboxinsertyourserverURLandinquerystringsendscreenandguestuserattributes.ClickNavigatebuttonandyouwillberedirectedtoyourserverURL(htttp://192.168.1.103/ITME81?screen=header&guestuser=1inourcase).WhenyouclickNavigatebuttonapplicationautomaticallyaddplatforminquerystringasattribute.
NotethatyoumusttorunyourITMEprojectbeforeyounavigatetoserverURLfromCognexWrapperApp.
![Page 19: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/19.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 19/28
![Page 20: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/20.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 20/28
BarcodeWidget Propert ies
loadScannerEventTrigger
$loadScannerEventTrigger="loadScanner(deviceType,sdk_key)"
WiththispropertywecallloadScanner(deviceType,sdk_key)methodwhichisthefirstthingweneedtodotoinordertousereaderdevice
Hastwoinputparameters.Firstoneshouldbe0ifwewanttouseMXDevicetoperform
![Page 21: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/21.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 21/28
scanningor1ifwewilluseMobileDeviceforscanning.Secondinputparameterissdk_keywhichisoptional.WeneedtosetoursdklicensekeyonlyifweuseMobileDeviceforscanningbarcodes.Otherwisewewillhaveasterisksinbarcodereaderresult.
ResultfromthiseventisreturnedinloadScannerOutputDatapropertyandloadScannereventiscalledascallbackfunction
Example:
'ForMXDevice$loadScannerEventTrigger="loadScanner(0)"'ForMobileDevice$loadScannerEventTrigger="loadScanner(1,SDK_KEY)"
connectEventTrigger
$connectEventTrigger="connect()"
Withthispropertywecallconnect()methodtoconnectwithourreaderdeviceandshouldbecalledafterweloadreaderdevice.
ResultfromthiseventisreturnedinconnectOutputDatapropertyandconnecteventiscalledascallbackfunction.
Example:
$connectEventTrigger="connect()"
disconnectEventTrigger
$disconnectEventTrigger="disconnect()"
Withthispropertywecalldisconnect()methodtoreleaseconnectionfromreaderdevice
ResultfromthiseventisreturnedindisconnectOutputDatapropertyanddisconnecteventiscalledascallbackfunction.
Example:
![Page 22: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/22.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 22/28
$disconnectEventTrigger="disconnect()"
setPreviewContainerPosit ionAndSizeEventTrigger
$setPreviewContainerPositionAndSizeEventTrigger=setPreviewContainerPositionAndSize(startPointX,startPointY,width,height)
WiththispropertywecallsetPreviewContainerPositionAndSize(startPointX,startPointY,width,height)methodwhichhas4inputparameters.startPointX,startPointY,widthandheightandtheyaremeasuredin%.
ThisshouldbecalledbeforeloadScannermethodandweuseittoplaceMobileDevicepreviewcontainer.
Example:
'PreviewContainerpositionedon0,0(left,top)100%rightand30%bottom.$setPreviewContainerPositionAndSizeEventTrigger="setPreviewContainerPositionAndSize(0,0,100,30)"
toggleScannerEventTrigger
$toggleScannerEventTrigger=“toggleScanner()”
WiththispropertywecalltoggleScanner()methodtostart/stopscanningprocess.
Example:
$toggleScannerEventTrigger=“toggleScanner()”
setSymbologyEnabledEventTrigger
![Page 23: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/23.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 23/28
$setSymbologyEnabledEventTrigger=setSymbologyEnabled(p1,p2,p3..)
Toenable/disablesymbologiesweusethispropertywhichtriggersetSymbologyEnabled(p1,p2,p3..)method.Asinputparameterswesetsymbologyandstatus.Wecanenable/disableoneormoresymbologiesinonecall.
Listofsymbols:UNKNOWN,DATAMATRIX,QR,C128,UPC-EAN,C11,C39,C93,I2O5,CODABAR,EAN-UCC,PHARMACODE,MAXICODE,PDF417,MICROPDF417,DATABAR,POSTNET,PLANET,4STATE-JAP,4STATE-AUS,4STATE-UPU,4STATE-IMB,VERICODE,RPC,MSI,AZTECCODE,DOTCODE,C25,C39-CONVERT-TO-C32,OCR,4STATE-RMC.
ResultfromthiseventisreturnedinsetSymbologyEnabledOutputDatapropertyandsetSymbologyEnabledeventiscalledascallbackfunction.
Example:
$setSymbologyEnabledEventTrigger="setSymbologyEnabled(DataMatrixON,C128OFF)"
setLightsOnEventTrigger
$setLightsOnEventTrigger=“setLightsOn(p1)”
Wecansetlighttobeenabled/disabledbydefaultwhenwestartscanningwiththispropertybytriggeringsetLightsOn(p1)method.AsinputparameterwesetONifwewanttoenableandOFFifwewanttodisablelightbydefault.
ResultfromthiseventisreturnedinsetLightsOnOutputDatapropertyandsetLightsOneventiscalledascallbackfunction.
Example:
$setLightsOnEventTrigger=“setLightsOn(ON)”
isLightsOnEventTrigger
$isLightsOnEventTrigger=“isLightsOn()”
![Page 24: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/24.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 24/28
TocheckiflightisenabledbydefaultwetriggerisLightsOn()method
ResultfromthiseventisreturnedinisLightsOnOutputDatapropertyandisLightsOneventiscalledascallbackfunction.
Example:
$isLightsOnEventTrigger=“isLightsOn()”
sendCommandEventTrigger
$sendCommandEventTrigger=“sendCommand(p1,p2,p3…)"
WiththispropertywecallsendCommand(p1,p2,p3…)methodthatexecutesDMCcommandswhicharesetasinputparameters.Wecansetoneormoredmccommandsasinputparameters.
ResultfromthiseventisreturnedinsendCommandOutputDatapropertyandsendCommandeventiscalledascallbackfunction
Example:
$sendCommandEventTrigger=“sendCommand(GETBATTERY.CHARGE)”
connect ionStateDidChangeOfReaderCallbackOutputData
Integerpropertythatrepresentcurrentreaderconnectionstate.Thereisfourstate:
0-CONNECTION_STATE_DISCONNECTED
1-CONNECTION_STATE_CONNECTING
2-CONNECTION_STATE_CONNECTED
3-CONNECTION_STATE_DISCONNECTING
resultCallbackOutputData
![Page 25: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/25.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 25/28
Stringpropertythatcontainlastscannedresult
availabilityCallbackOutputData
Booleanpropertythatistrueifourreaderdeviceisavailableorfalseifreaderdeviceisunavailable.
act iveStartScanningCallbackOutputData
Booleanpropertywhichwillbetruewhenscanningisactiveorfalsewhenscanningisstopped.
loadScannerOutputData
WhenloadScannermethodisexecuteditreturnsuccessmessageorerrormessageifreaderdevicecan’tbeloaded.
connectOutputData
Whenconnectmethodisexecuteditreturntrueifconnectionissuccessfulorerrormessageifconnectioncan’tbecompleted
disconnectOutputData
Whendisconnectmethodisexecuteditreturnsuccessmessageorerrormessageifthereisproblemwhileweexecutethismethod
isSymbologyEnabledOutputData
InthispropertywereturnresultfromisSymbologyEnabledmethod.ResultwillbeONifcertainsymbologyisenabled,OFFifisdisabledorerrormessageifthereissomeerrorthrownwhileweexecutethismethod.SinceisSymbologyEnabledmethodcanhavemorethanoneparameterwewillreturnsymbologystatusseparatedwith“,”.Forexampleifwecall$isSymbologyEnabledEventTrigger="isSymbologyEnabled(DataMatrix,C128)"resultwillbe“ON,ON”ifbothsymbologiesareenabled.
NotethatbydefaultifweuseMobileDevicethereisnosymbologiesenabled.
![Page 26: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/26.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 26/28
isLightsOnOutputData
ResultfromisLightsOnmethodthatcanbeONiflightisenabled,OFFifisdisabledorerrormessageifsomethingwronghappenedwhilethiscommandisexecuted
sendCommandOutputData
StringpropertythatrepresentresultfromsendCommand()method.IfthereismorethanoneDMCcommandsasinputparametersresultfromeverycommandwillbeseparatedwith“,”.
Forexample,ifwecall$sendCommandEventTrigger=“sendCommand(GETBATTERY.CHARGE,GETLIGHT.INTERNAL-ENABLE)”resultwillbe“50,OFF”
setLightsOnOutputData
ResultfromsetLightsOnmethodthatcanbeONiflightisenabled,OFFifisdisabledorerrormessageifsomethingwronghappenedwhilethiscommandisexecuted
setSymbologyEnabledOutputData
InthispropertywereturnresultfromsetSymbologyEnabledmethod.ResultwillbeONifcertainsymbologyisenabled,OFFifisdisabledorerrormessageifthereissomeerrorthrownwhileweexecutethismethod.SincesetSymbologyEnabledmethodcanhavemorethanoneparameterwewillreturnsymbologystatusseparatedwith“,”.Forexampleifwecall$setSymbologyEnabledEventTrigger="setSymbologyEnabled(DataMatrix,C128)"resultwillbe“ON,ON”ifbothsymbologiesareenabled.
BarcodeWidget Events
sendCommand
ThiscallbackeventwillbeexecutedwhensendCommandmethodistriggeredandfinished:$sendCommandEventTrigger="sendCommand(p1,p2,p3...)"
isLightsOn
![Page 27: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/27.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 27/28
ThiscallbackeventwillbeexecutedwhenisLightsOnmethodistriggeredandfinished:$isLightsOntEventTrigger="isLightsOn()"
setLightsOn
ThiscallbackeventwillbeexecutedwhensetLightsOnmethodistriggeredandfinished:$setLightsOnEventTrigger="setLightsOn(p1)"
isSymbologyEnabled
ThiscallbackeventwillbeexecutedwhenisSymbologyEnabledmethodistriggeredandfinished:$isSymbologyEnabledEventTrigger="isSymbologyEnabled(p1,p2,p3,.....)"
setSymbologyEnabled
ThiscallbackeventwillbeexecutedwhensetSymbologyEnabledmethodistriggeredandfinished:$setSymbologyEnabledTrigger="setSymbologyEnabled(p1,p2,p3,.....)"
disconnect
Thiscallbackeventwillbeexecutedwhendisconnectmethodistriggeredandfinished:$disconnectEventTrigger="disconnect()"
connect
Thiscallbackeventwillbeexecutedwhenconnectmethodistriggeredandfinished:$connectEventTrigger="connect()"
loadScanner
ThiscallbackeventwillbeexecutedwhenloadScannermethodistriggeredandfinished:$loadScannerEventTrigger="loadScanner(0)"
setAct iveStartScanningCallback
![Page 28: InTouch Machine Edition (v2.2.x) - Cognex](https://reader031.vdocuments.us/reader031/viewer/2022012515/618f6249660b103f1b601634/html5/thumbnails/28.jpg)
t it le:InTouchMachineEdit ion(v2.2.x);ver:2.6.x 28/28
'ThiscallbackeventwillbeexecutedwhentoggleScannermethodistriggeredandfinished:$toggleScannerEventTrigger="toggleScanner()"
setAvailabilityCallback
ThiscallbackeventwillbeexecutedwhenavailabilityofMXDeviceischanged.
setResultCallback
Whenbarcodeisscannedthiscallbackeventwillbeexecuted
setConnect ionStateDidChangeOfReaderCallback
Thiscallbackeventwillbeexecutedwhenconnectionstateofreaderdeviceischanged