Skip to content

Commit

Permalink
port configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxblh committed Aug 1, 2019
1 parent 166575b commit 53f3199
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const { KEYS } = require('samsung-tv-control/lib/keys')
const { APPS } = require('samsung-tv-control/lib/apps')

const config = {
name: 'NodeJS-Test', // Default: NodeJS
debug: true, // Default: false
ip: '192.168.1.2',
mac: '123456789ABC',
name: 'NodeJS-Test', // Default: NodeJS
port: 8001, // Default: 8002
token: '12345678',
debug: true // Default: false
}

const control = new Samsung(config)
Expand Down
4 changes: 2 additions & 2 deletions example/index-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const { KEYS } = require('../lib/keys')
const { APPS } = require('../lib/apps')

const config = {
name: 'NodeJS-Test', // Default: NodeJS
debug: true, // Default: false
ip: '192.168.1.2',
mac: '123456789ABC',
name: 'NodeJS-Test', // Default: NodeJS
token: '12345678',
debug: true // Default: false
}

const control = new Samsung(config)
Expand Down
5 changes: 3 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ const { KEYS } = require('samsung-tv-control/lib/keys')
const { APPS } = require('samsung-tv-control/lib/apps')

const config = {
name: 'NodeJS-Test', // Default: NodeJS
debug: true, // Default: false
ip: '192.168.1.2',
mac: '123456789ABC',
name: 'NodeJS-Test', // Default: NodeJS
port: 8002, // Default: 8002
token: '12345678',
debug: true // Default: false
}

const control = new Samsung(config)
Expand Down
5 changes: 3 additions & 2 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import Samsung from './index'
describe('sum', () => {
it('Successful create instance', () => {
const config = {
name: 'NodeJS-Test', // Default: NodeJS
debug: true, // Default: false
ip: '192.168.1.2',
mac: '123456789ABC',
name: 'NodeJS-Test', // Default: NodeJS
port: 8001, // Default: 8002
token: '12345678',
debug: true // Default: false
}

const control = new Samsung(config)
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface Configuration {
nameApp?: string
/** Verbose Mode */
debug?: boolean
/** Port, for old models 8001 (Default: 8002) */
port?: number
}

interface App {
Expand All @@ -40,7 +42,7 @@ interface Command {
class Samsung {
private IP: string
private MAC: string
private PORT: string
private PORT: number
private TOKEN: string
private NAME_APP: string
private DEBUG: boolean
Expand All @@ -56,7 +58,7 @@ class Samsung {

this.IP = config.ip
this.MAC = config.mac
this.PORT = '8002'
this.PORT = config.port || 8002
this.TOKEN = config.token || ''
this.NAME_APP = Buffer.from(config.nameApp || 'NodeJS Remote').toString('base64')
this.DEBUG = config.debug || false
Expand Down

0 comments on commit 53f3199

Please sign in to comment.