Home AMX User Forum NetLinx Studio
Options

D:P:S addressing in different contexts

Say I define my device as
dvTPMBR = 10201

and I have the following event....the event works fine.

BUTTON_EVENT[dvTPMBR:2:0,1] {
PUSH: {
send_command dvTPMBR:2:0, "'^TXT-1,1&2,',TIME";
}
}

But then I separately have a structure with a DEV component

structure _sTPInfo {
dev dTP
}

If I have an array of these _sTPInfo structures, I can't address a specific port, like I could with the BUTTON_EVENT. The following code results in an error: C10512: Cannot convert type [DEV] to [INTEGER]

//inside a function that takes _sTPInfo sTPInfo[] as an argument
DEV dTP
char cTPIndex

dTP = sTPInfo[cTPIndex].dTP:3:0

Any ideas? It seems inconsistent to me, but this is the first time I've goofed with this. There must be a way to address various ports on a dev w/in an array of structures...
-Bill

Comments

  • Options
    dchristodchristo Posts: 177
    In your structure, you are defining a DEV, while in the example at the begining of your post you are only defining an integer. If you change the data type in your structure to an integer it should work as expected.

    --D

    Edit: You could also change the last line to:

    dTP = sTPInfo[cTPIndex].dTP.device:3:0

    which should work also (only returning the device element of the DEV)
  • Options
    DHawthorneDHawthorne Posts: 4,584
    You can access all the elements of a DEV structure.

    If a panel, for example, is defined as

    dvPanel = 10001: 1:0

    ...then you use

    dvPanel.NUMBER = 10001
    dvPanel.PORT = 1
    dvPanel.SYSTEM = <whatever your system number is, since the 0 in the defnition is a shortcut for the current system).

    I use these all the time in modules to report a device in SEND_STRING 0 statements for debugging so I can differentiate between different instances. There is a debug.axi file on the AMX site somewhere that also wraps them into nice little DEV to string functions.
Sign In or Register to comment.