Skip to content

Latest commit

 

History

History
623 lines (617 loc) · 19.4 KB

MIGRATION.md

File metadata and controls

623 lines (617 loc) · 19.4 KB

ads-client migration

This document contains breaking changes between ads-client major versions.

1.x.x --> 2.x.x

Client general

Changes Action
settings
  • checkStateInterval renamed to connectionCheckInterval
  • disableSymbolVersionMonitoring renamed to monitorPlcSymbolVersion (and operation inverted)
  • bareClient renamed to rawClient
  • disableBigInt removed
  • Check if renamed settings were used and rename them
    • E.g. const client = new Client({bareClient: true, ...})
      ->
      const client = new Client({rawClient: true, ...})
  • Check if removed settings were used and remove them
metaData
  • systemManagerState renamed to tcSystemState
  • symbolVersion renamed to plcSymbolVersion
  • uploadInfo renamed to plcUploadInfo
  • allSymbolsCached renamed to allPlcSymbolsCached
  • symbols renamed to plcSymbols
  • allDataTypesCached renamed to allPlcDataTypesCached
  • dataTypes renamed to plcDataTypes
  • Check if renamed metadata properties were used and rename them
    • E.g. client.metaData.symbolVersion
      ->
      client.metaData.plcSymbolVersion
Errors
  • Error object ClientException renamed to ClientError
  • Properties changed
  • Change all usages of ClientException to ClientError
  • Check that old properties of the error object are not used and change to use new properties ({adsError, stack})
Events
  • systemManagerStateChange event renamed to tcSystemStateChange
  • symbolVersionChange event renamed to plcSymbolVersionChange
  • ads-client-error renamed to client-error
  • Check if renamed events were used and rename them
    • E.g. .on('systemManagerStateChange', ...)
      ->
      .on('tcSystemStateChange', ...)
Subscription callback
  • Callback data parameter property timeStamp renamed to timestamp
  • Check if data.timeStamp was used in subscription callback and rename it
    • E.g. console.log(`${data.timeStamp}: Value changed to ${data.value}`)
      ->
      console.log(`${data.timestamp}: Value changed to ${data.value}`)
Symbol object (e.g. from getSymbol())
  • Properties removed: nameLength, typeLength, commentLength, attributeCount
  • Check if renamed properties were used and rename them
  • Check if removed properties were used and remove them
Data type object (e.g. from getDataType())
  • Properties removed: nameLength, typeLength, commentLength, subItemCount, attributeCount
  • Property enumInfo renamed to enumInfos
  • Property arrayData renamed to arrayInfos
  • Check if renamed properties were used and rename them
  • Check if removed properties were used and remove them
Conversion of ENUM values
  • If ENUM value has no corresponding string value, it's set to empty string instead of null
    • E.g. {name: null, value: 123}
      ->
      {name: '', value: 123}
  • Check if ENUM value name was checked for null and change to check for empty string instead

Client methods

Changes Action
setDebugging()
  • Renamed to setDebugLevel()
  • Debug levels changed: 0,1,2,3 instead of 0,1,2,3,4
  • Rename all setDebugging() calls to setDebugLevel()
  • Change all debug levels of 1 to 0
  • Change all debug levels of 2 to 1
  • Change all debug levels of 3 to 2
  • Change all debug levels of 4 to 3
subscribe()
  • Rename all subscribe() calls to subscribeValue()
  • Check if default cycle time was used and set cycleTime it if needed
NOTE: Consider using the new subscribe() instead
subscribeRaw()
  • Check if default cycle time was used and set cycleTime it if needed
NOTE: Consider using the new subscribe() instead
unsubscribe()
  • No longer accepts a numeric handle value
    • Reason: multiple targets are allowed, numeric handle values are no longer unique
  • Check that all client.unsubscribe() calls use handle object as parameter instead of a numerical handle value
    • If you always use return value of a subscription method, everything if fine
    • E.g. const { handle } = await client.subscribe(...); await client.unsubscribe(handle) is OK!
readSymbol()
  • Renamed to readValue()
  • Rename all readSymbol() calls to readValue()
readRaw()
  • Parameter targetAdsPort removed
  • Parameter targetOpts added
  • If target ADS port was overridden with targetAdsPort, change to use new targetOpts format instead
    • readRaw(*, *, *, 852)
      ->
      readRaw(*, *, *, { adsPort: 852 })
writeSymbol()
  • Renamed to writeValue()
  • Rename all writeSymbol() calls to writeValue()
writeRaw()
  • Parameter targetAdsPort removed
  • Parameter targetOpts added
  • If target ADS port was overridden with targetAdsPort, change to use new targetOpts format instead
    • writeRaw(*, *, *, 852)
      ->
      writeRaw(*, *, *, { adsPort: 852 })
readRawMulti()
  • Return value type changed
  • Parameter targetAdsPort removed
  • Parameter targetOpts added
  • Change all readRawMulti() calls to use new return value type
    • {success, errorInfo, target, data}[]
      ->
      {success, command, value, error, errorCode, errorStr}[]
    • Old data property is renamed to value
  • If target ADS port was overridden with targetAdsPort, change to use new targetOpts format instead
    • readRawMulti(*, 852)
      ->
      readRawMulti(*, { adsPort: 852 })
writeRawMulti()
  • Return value type changed
  • Parameter targetAdsPort removed
  • Parameter targetOpts added
  • Change all writeRawMulti() calls to use new return value type
    • {success, errorInfo, target}[]
      ->
      {success, command, error, errorCode, errorStr}[]
  • If target ADS port was overridden with targetAdsPort, change to use new targetOpts format instead
    • writeRawMulti(*, 852)
      ->
      writeRawMulti(*, { adsPort: 852 })
restartPlc()
startPlc()
stopPlc()
  • Parameter adsPort removed
  • Parameter targetOpts added
  • If target ADS port was overridden with adsPort, change to use new targetOpts format instead
    • E.g. restartPlc(852)
      ->
      restartPlc({ adsPort: 852 })
writeControl()
  • Parameter order has changed
  • adsState allows string value as well
  • Parameter adsPort removed
  • Parameter targetOpts added
  • Change parameter order and adsPort parameter to use new targetOpts format instead
    • E.g. writeControl(10000, 16, 0)
      ->
      writeControl(16, 0, undefined, { adsPort: 10000 })
getEmptyPlcType()
  • Renamed to getDefaultPlcObject()
  • Rename all getEmptyPlcType() calls to getDefaultPlcObject()
getSymbolInfo()
  • Renamed to getSymbols()
  • Rename all getSymbolInfo() calls to getSymbols()
readAndCacheSymbols()
  • Method removed
  • Use cacheSymbols() to cache all symbols
  • Use getSymbols() to get all symbols
readAndCacheDataTypes()
  • Method removed
  • Use cacheDataTypes() to cache all data types
  • Use getDataTypes() to get all data types
setSystemManagerToRun()
  • Renamed to setTcSystemToRun()
  • Rename all setSystemManagerToRun() calls to setTcSystemToRun()
setSystemManagerToConfig()
  • Renamed to setTcSystemToConfig()
  • Rename all setSystemManagerToConfig() calls to setTcSystemToConfig()
restartSystemManager()
  • Renamed to restartTcSystem()
  • Rename all restartSystemManager() calls to restartTcSystem()
readSymbolVersion()
  • Renamed to readPlcSymbolVersion()
  • Rename all readSymbolVersion() calls to readPlcSymbolVersion()
readUploadInfo()
  • Renamed to readPlcUploadInfo()
  • Rename all readUploadInfo() calls to readPlcUploadInfo()
readRawByName()
  • Renamed to readRawByPath()
  • Rename all readRawByName() calls to readRawByPath()
createVariableHandleMulti()
  • Return value type changed
  • Return value property handle type changed from number to object
  • Change all createVariableHandleMulti() calls to use new return value type
    • {success, errorInfo, target, handle}[]
      ->
      {success, path, handle, error, errorCode, errorStr}[]
  • If returned handle property was used as a number, change it to use new returned handle.handle
deleteVariableHandleMulti()
  • Return value type changed
  • Return value property handle type changed from number to object
  • Change all deleteVariableHandleMulti() calls to use new return value type
    • {success, errorInfo, target, handle}[]
      ->
      {success, handle, error, errorCode, errorStr}[]
  • If returned handle property was used as a number, change it to use new returned handle.handle