WinMark Pro v5.0 ActiveX Interface

           

The ActiveX interface from WinMark V4 is no longer viable as WinMark V5 now supports multiple marking head types, in both normal operation and standalone operation. The v5.0 ActiveX control is different from V2/V4 and is named “Synrad WinMark Pro Control Version 5.0”.

 

Changes to the interface includes new functions for Flyer and the fact that V5 allows selection of multiple heads across processes. At this time, multiple V5 ActiveX controls cannot exist in one process, but multiple processes each with an ActiveX control can be spawned and made to control different heads. This ActiveX control (SynMhAtx) only supports normal marking, no standalone functions at this time. A different v5 ActiveX control will follow that supports standalone functions only.

 

Following are the interface additions added to support FH Flyer and multiple head functionality

 

Methods:

 

[id(60)] short GetCurrentMarkingHead();

 

[id(61)] short SetCurrentMarkingHead(short Index);

 

[id(62)] short GetMarkHeadName(short Index, BSTR* pName);

 

[id(63)] short GetMarkHeadType(short Index);

 

[id(64)] short GetMarkHeadCount();

 

[id(65)] short ConnectToEthernetFlyer(BSTR strAddress);

 

[id(66)] short GetDigitalString(BSTR* pData);

 

[id(67)] short SetDigitalString(BSTR* pData);

 

[id(68)] short GetSystemProp(BSTR strProp, BSTR* pStrValue);

 

[id(69)] short SetSystemProp(BSTR strProp,BSTR strValue);

 

[id(70)] short GetFlyerTemperature(float* pFront, float* pBack);

 

[id(71)] short GetMarkHeadStatus(short Index);

 

[id(72)] short GetSystemPropertyCount();

 

[id(73)] short GetSystemPropertyNameByIndex(short PropIndex,BSTR* pStrName);

 

[id(74)] short ConnectPreviewWnd(long pParent, long pPreview);

 

 

Function Explanations:                                

 

GetCurrentMarkingHead():

Get the index of the currently selected marking head, 0 based. If there is a problem, -1 will be returned when no marking head is selected, and –2 if the currently selected index is bad(less than zero, or greater than the highest valid index), -3 if the head is unavailable.

 

 

SetCurrentMarkingHead(short Index):

Set the index of the currently selected marking head, 0 based to Index passed in by the function. If there is a problem, -1 will be returned when no marking head is selected, and –2 if the currently selected index is bad (less than zero, or greater than the highest valid index), -3 if the head is unavailable.

 

 

GetMarkHeadName(short Index, BSTR* pName):

Get the name of the marking head with index Index. This is a name stored on the Flyer head and limited to 255 characters (which is the size that pName should be set to accept), but stored in the registry for other heads. It is intended as a user defined name to easily tell the head that is associated with this index, “Flyer North Line 3” for example. If the index is valid GetMarkHeadName will set the pName to the correct name, otherwise it will return an error code. –2 will be returned if the currently selected index is bad (less than zero, or greater than the highest valid index), -3 if the head is unavailable. The Name of the head for Flyer can be changed through the SetSystemProp command.

 

 

GetMarkHeadType(short Index):

Get the type of the head connected at index Index. This will return:

1 for FH style heads

2 for SmartFH heads

3 for Scanlab heads

4 for Flyer heads

-2 if Index is out of range or less than 0.

-3 if the head at Index is unavailable for some reason.

 

 

GetMarkHeadCount():

Returns the number of heads currently available on the system, including heads in use by other controls or WinMark. So the function may return that there are 5 heads connected, but only two are actually free to be used by this control instance (because the other three are in use by other controls and/or WinMark). To figure out which heads are available in a multiple head configuration, the control will have to query each index using GetMarkHeadStatus().

If a head is added (Flyer USB) the count will be incremented and the next higher index from the highest valid index will be associated with that head. For example, four heads connected, 3 is the highest valid index. When a new head is connected, it will get the index of 4.

 

 

ConnectToEthernetFlyer(BSTR strAddress):

StrAddress can be either a string representing an IP address “192.168.0.5” or a DNS or WINS name “FlyerNorth.Synrad.com” or “MarkingHead”. Upon a successful connection, the function will return the index associated with the head added and the head count will be incremented. If the connection cannot be negotiated successfully, the function will return a –3(Head Unavailable).

 

 

GetDigitalString(BSTR* pData):

If successful, returns the current head index, and changes pData accordingly to the current length of pData from the current marking head. This is primarily for Flyer heads, but may work well with others (FH, Scanlab, SmartFH).

The function prefers one of 2 string lengths, 8, or 16 characters terminated by a NULL character.

If pData is an eight-character string, it will represent the input byte with the first character as bit 0 and the last as bit 7.

If pData is a 16-character string, the first character represents input 0 and the 16th character will be input 15.

If pData is any other length that is greater than 8 bytes but not 8 or 16 bytes, the function will presume an 8-character string as the default.

In the case of the marking head having fewer input or output bits than the character string, the invalid bits will always be zero. If the function fails, the function does not change wData and returns a –1 if no head is currently selected, a –3 (Head is Unavailable) or a –4, Incorrect data format, signifying the caller passed in a string that is of length less than 8 characters.

 

 

SetDigitalString(BSTR pData):

If successful, returns the current head index,. This is primarily for Flyer heads, but may work well with others (FH, Scanlab, SmartFH). The function prefers one of 2 string lengths, 8, or 16 characters terminated by a NULL character.

If pData is an eight-character string, it will represent the output byte with the first character as bit 0 and the last as bit 7.

If pData is a 16-character string, the first character represents output 0 and the 16th character will be output 15.

If pData is any other length that is greater than 8 bytes but not 8 or 16 bytes, the function will presume an 8-character string as the default.

In the case of the marking head having fewer output bits than the character string, the invalid bits will always be zero.

If the function fails, it returns a –1 if no head is currently selected, a –3 (Head is Unavailable) or a –4, Incorrect data format, signifying the caller passed in a string that is of length less than 8 characters or one of the characters was something other than a “1”, “0” or “-“(Ignore).

 

 

SetSystemProp(BSTR strProp, BSTR strValue):

The function will attempt to set strProp to strValue on the current marking head.

If successful, the function will return the head index. Otherwise on failure, the function will return an error code. If the function fails, it will return a-1 if no head is currently selected, a –3 for head is unavailable, a –4 if strProp or strValue is invalid , -5 if strValue is incorrect for the property type, -6 if the property is read-only. An example where –5 would be returned is if strProp is set to “EncoderResolution” and strValue is set to “thirty”. The head will only allow a string in a floating-point format for Encoder Resolution.

NOTE: If strProp is not a known system property, it is stored as a new string that can be set/retrieved at will. See GetSystemProp explanation.

 

 

GetSystemProp(BSTR strProp, BSTR* pStrValue):

If strProp is a valid system property, the function will return set the value of pStrValue to the property value(the caller is responsible to allocate a minimum size to pStrValue to hold the value which can be no greater than 255 bytes) in a string format and return Index. Otherwise it will return an error code. This function is solely for Flyer at this time, but may eventually work for SmartFH as well.

For Flyer, the system properties are stored on the head FLASH. The properties can also take new names and store them even though the firmware knows nothing about these new properties. This allows the ActiveX user to store data on the head that will be there for any other control from any computer at a later time. The use of this should be limited to small amounts of data(< 256 characters per string) and less than 1024 strings.

Since these properties are written/read from Flash, this is not a good place to store data that is frequently changing such as serial numbers that change on every mark. There will be a way to access battery backed RAM storage that is more suitable for this type of data. Also reads and writes are much faster on the battery backed RAM than from the Flash.

If the function fails, it will return a –1 if there is no head selected, a –3 for head is unavailable, a –4 if the strProp is invalid or if pStrValue is NULL.

 

The current valid list of system properties to be set on Flyer are:

 

“FlyIpAddress" : Address to be used if the head is set to static, IP address form only like “192.168.0.5”.

"FlyIpMask" : The netmask to be used if the head is set to static, typically “255.255.255.0”.

"FlyIpBroadcast" : The broadcast address to be used if the head is set to static, typically “255.255.255.255”.

"FlyIpGateway" : The gateway address to be used if the head is set to static.

"FlyIpDns1" : The primary DNS server address to be used if the head is set to static.

"FlyIpDns2" : The secondary DNS server address to be used if the head is set to static.

 

"FlyUseDHCP" : “1” is grab an IP address dynamically from the DHCP server (dynamic), “0” configure the address using the IP information in this configuration (static).

 

"FlyIpAllow(0-9)” : A way to limit which computers have access to the head. For example “192.168.0.0/255.255.255.0) limits the allowable ip’s to the 192.168.0 subnet. This is not yet implemented.

 

" FlyIpDeny (0-9)” : A way to deny computer access to the head. For example “192.168.0.5/255.255.255.255) denies access of 192.168.0.5 to the head. This is not yet implemented.

 

"EncoderResolution" : floating point number in pulses per mm “12.93” for example.

“InvertEncoderDirection" : 1 for true, 0 for false.

"RisingEdgePartSense" : 1 for true, 0 for false.

"SensorDistance" : floating point number giving the distance in inches.

"QuadEncoder" : 1 for true, 0 for false.

"UseEncoderless" : 1 for true, 0 for false.

"UseFixedPartPitch" : 1 for true, 0 for false.

"PartPitch" : floating point number representing the part-to-part distance in inches for encoderless tracking.

"LineSpeed" : floating point number in inches/sec for encoderless tracking.

"MotionVector" : floating point number between 0-360 giving the orientation of tracking.

 

"ObjectName" : This is the name of the head and in WinMark is what is shown in the mark button.

"FlyLens" : an integer representing the lens used on the head. The currently allowed selections are:

80 mm lens                   6

125 mm lens                 5

200 mm lens                 2

370 mm lens                 4

125HP mm lens             7

 

any number other than these and the head will default to 200 mm lens(2).

 

“StartUpDrawing" : String containing the path on the head to mark on startup for standalone marking.

"MarkOnStart" : “1” for true, “0” for false, (standalone marking).

 

"CustomDateCode(0-?)" : string representing the custom date code (standalone marking)

"ShiftCodes"(0-23)" : string representing the shift code (standalone marking)

 

"FlyUbootVersion" : Read-only string giving the U-boot bootloader version.

"FlyKernelVersion" : Read-only string giving the Linux kernel version.

"FlyVersion" : Read-only string giving the firmware version.

"FlySerialNumber" : Read-only string giving the Flyer serial number.

"FlyMacAddress" : Read-only string giving the Flyer MAC address.

 

"KeyboardLocked" : “1” lock the keyboard, “0” unlock the keyboard.

"FlyFasiEnable" : Read-only string showing whether the FASI switch is on or off.

"FlyPwmGate” : Read-only string showing whether the PWM output is switched to PWM or a gate signal.

"FlyTickleDisable" : Read-only string showing whether the tickle is switched to disable or normal(with tickle). 

 

"FlyShareUser" : String giving the user name to connect to a windows share on the network, Not fully implemented.

"FlySharePassword" : password for the user name to connect to a windows share on the network, Not fully implemented.

"FlyShareServer" : String giving the IP address or DNS name of the server (if DNS is setup correctly), Not fully implemented.

"FlyShareName" : The “path” to the share “\\server\path” , Not fully implemented.

"FlyShareReadOnly" : “1” Connect to the share with read-only access, “0” connect to the share with the same rights normally given to the username in “FlyShareUser” , Not fully implemented.

 

"ClearingMarkInterval" : (standalone marking only)Integer representing the clearing mark interval, 0 is off.

"ClearingMarkSessionStart": (standalone marking only) ”1” Run a clearing mark at the mark session start , “0”, Do NOT run a clearing mark at mark session start (standalone marking).

 

 

GetFlyerTemperature(float* pFront, float* pBack)

If the current head is valid and is a Flyer, the function will retrieve the floating-point value of the temperature of the front and Back in Fahrenheit. If this function fails, it will return a –1 if there is currently no selected head, –3 if the head is unavailable, or a –5 if the head is not the right type.

 

 

GetMarkHeadStatus(short Index)

If the Index is valid, this function will return a 1 if the head is available, a 0 if the head is in use by another control/WinMark.

If the function fails, it will return a –2 for a bad Index, or a –3 if the status is unavailable.

 

 

GetSystemPropertyCount():

Returns the count of system properties on the current marking head, custom or otherwise.

If the function fails, it will return a –1 if there is no currently selected head, or a –3 if the status is unavailable.

 

 

GetSystemPropertyNameByIndex(short PropIndex, BSTR* pStrName):

If PropIndex is valid, the function will put the name of the property into pStrName and return the HeadIndex.

If the function fails, it will return a-1 if there is no currently selected head, -3 if the head is unavailable, -4 if PropIndex is out of range or if pStrName is NULL.

 

 

ConnectPreviewWnd(long pParent, long pPreview)

Connect Preview Wnd takes in the hWnd of a Preview window that is defined in the form as an image object (in VB) and assigns the preview wnd to use this as its main window. This is useful as it removes the development crashes in VB when inserting the SynMhAtx object into a form, viewing the form and starting the application. Due to the fact that viewing the form opens up the ActiveX control within the VB6 IDE and running the debug version also opens up another instance within the same process, this causes the VB6 IDE to crash and developers to lose any unsaved data.

 By putting an image object in the form and then using this function and passing the hWnd of the image object in pPreview, this issue with VB is avoided. Currently the pParent variable is not used, but may be used in the future.