> For the complete documentation index, see [llms.txt](https://zmink.gitbook.io/node-tcrouter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zmink.gitbook.io/node-tcrouter/docs/tcrouter.md).

# TCRouter

## TCRouter

Manage the tc router device

**Kind**: global class

* [TCRouter](/node-tcrouter/docs/tcrouter.md#TCRouter)
  * [new TCRouter(ip, port, timeout)](/node-tcrouter/docs/tcrouter.md#new_TCRouter_new)
  * [.getMutableInfo()](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+getMutableInfo)
  * [.sendSMS(contacts, content)](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+sendSMS)
  * [.checkForSmsRx()](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+checkForSmsRx) ⇒ `Promise`
  * [.ackSmsRx()](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+ackSmsRx) ⇒ `Promise`
  * [.controlOutput(index, value)](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+controlOutput)
  * [.controlDataConnection(state)](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+controlDataConnection)
  * [.controlVPN(type, index, state)](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+controlVPN)
  * [.getAllInfo()](https://zmink.gitbook.io/node-tcrouter/docs/pages/-Lpv9W3Qo79yLQveiDs5#TCRouter+getAllInfo)

### new TCRouter(ip, port, timeout)

Manages socket api to TCRouter device

| Param   | Type     | Description                                |
| ------- | -------- | ------------------------------------------ |
| ip      | `string` | IP Address of the TC Router                |
| port    | `number` | TCP Port number of TC Router socket server |
| timeout | `number` | Timeout in milliseconds for the tcp client |

### tcRouter.getMutableInfo()

Request mutable status info from the router and return last known values of static values

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public<br>

### tcRouter.sendSMS(contacts, content)

Send an SMS message to the TC Router

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public

| Param    | Type     | Description     |
| -------- | -------- | --------------- |
| contacts | `Array`  | -               |
| content  | `String` | message content |

### tcRouter.checkForSmsRx() ⇒ `Promise`

Checks the TC router for an sms which has been received. Returns the contents of the sms. Should be acknowledged after receipt using the ackSmsRx function

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public<br>

### tcRouter.ackSmsRx() ⇒ `Promise`

Acknowledges the last received sms - TC Router then deletes this message from its history and is no longer accessible. Results of the message ack'd should be stored

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public<br>

### tcRouter.controlOutput(index, value)

Control outputs on the Router

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public

| Param | Type      | Description                                                  |
| ----- | --------- | ------------------------------------------------------------ |
| index | `integer` | Index of the output on the router which should be controlled |
| value | `bool`    | False: turn output off, True: turn output on                 |

### tcRouter.controlDataConnection(state)

Control data connection if configured correctly on device web page

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public

| Param | Type   | Description               |
| ----- | ------ | ------------------------- |
| state | `bool` | turn connection on or off |

### tcRouter.controlVPN(type, index, state)

Start or stop VPN connections

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public

| Param | Type      | Description                               |
| ----- | --------- | ----------------------------------------- |
| type  | `number`  | 0:ipsec,1:openvpn                         |
| index | `number`  | Index/Number/ID of the desired vpn tunnel |
| state | `boolean` | 0:turn off,1:turn on                      |

### tcRouter.getAllInfo()

Build, send, update, and return all device 'info'

**Kind**: instance method of [`TCRouter`](/node-tcrouter/docs/tcrouter.md#TCRouter)\
**Access**: public


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://zmink.gitbook.io/node-tcrouter/docs/tcrouter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
