Home AMX User Forum AMX General Discussion

4 digit Channels

I just thought I'd post a call I made to sort of emulate the XCH command, but this one works with the new 4 digit channels found on the DISH Satellite network.
DEFINE_CALL 'SEND CHAN' (DEV dvIROUT, INTEGER nCHAN, INTEGER nENTER_CHAN) // Same as XCH, but supports 4 digit channel
{
STACK_VAR INTEGER x1
STACK_VAR INTEGER x2
STACK_VAR INTEGER x3
STACK_VAR INTEGER x4

x4 = nCHAN/1000 + 10
IF(x4-10)
SEND_COMMAND dvIROUT,"'SP',x4"

x3 = (nCHAN - ((nCHAN/1000)*1000))/100 + 10
IF(x4-10 or x3-10)
SEND_COMMAND dvIROUT,"'SP',x3"

x2 = (nCHAN - ((nCHAN/100)*100))/10 + 10
IF(x4-10 or x3-10 or x2-10)
SEND_COMMAND dvIROUT,"'SP',x2"

x1 = (nCHAN - ((nCHAN/10)*10)) + 10
IF(x4-10 or x3-10 or x2-10 or x1-10)
SEND_COMMAND dvIROUT,"'SP',x1"

IF(nENTER_CHAN)
SEND_COMMAND dvIROUT,"'SP',nENTER_CHAN"

}

Hope this helps someone. Also, feel free to let me know how I can improve my coding.

Jeff

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    Ohh, I forgot to mention..... this doesn't support all of the different delivery options supported by XCH, but it could easily be modified to send the leading zeros if needed. Sending a 0 value for the Enter channel prevents the enter command from being sent. It has been tested with the standard DISH receivers as is and it does function properly.

    Jeff
Sign In or Register to comment.