GST.IoT.Library

FA팀에서 개발하는 IoT용 프로그램에 GSTBrowser에서 사용되는 공통 메서드 참조용 API 문서

종속성

  • .NET Framework 4.6.1 이상

  • GST.Platform.Client.Library.dll

  • GST.Platform.ServiceInterface.dll

주의 사항

ServiceInterface class

[ Constructors ]

public ServiceInterface(Uri serviceUri, string internalIP);

[ Properties ]

ServiceUri

  • 생성자를 통해 할당된 웹 서비스 URI

InternalIP

  • 생성자를 통해 할당된 웹 서비스 URI의 내부 IP

[ Methods ]

FileExists

  • 서버의 파일 첨부 루트 디렉터리로부터 경로(string filename)에 파일 존재 여부 반환

  • Parameters

    • string filename : 파일 경로 (서버 기준)

  • Returns

    • bool : 존재하면 true, 아니면 false

FileUpload

  • 서버의 파일 첨부 루트 디렉터리로부터 경로(string filename)에 파일을 업로드

  • Parameters

    • string filename : 파일 경로 (서버 기준)

    • byte[] fileBytes : 업로드할 파일의 이진 데이터

    • bool isOverWrite : 덮어쓰기 여부 (덮어쓰기를 하지 않을때 중복된 이름의 파일이 존재하면 이름을 다르게 생성)

  • Returns

    • string[]

      • [0] : 업로드 성공 여부 ("OK" or Exception.Message)

      • [1] : 업로드 파일명 (업로드 실패시 Exception.ToString() 값)

FileDownload

  • 서버의 파일 첨부 루트 디렉터리로부터 경로(string filename)의 파일을 다운로드

  • Parameters

    • string filename : 파일 경로 (서버 기준)

  • Returns

    • byte[] : 다운로드 받은 파일의 이진 데이터, 파일이 존재하지 않으면 null

FileDelete

  • 서버의 파일 첨부 루트 디렉터리로부터 경로(string filename)의 파일을 제

  • Parameters

    • string filename : 파일 경로 (서버 기준)

  • Returns

    • string[]

      • [0] : 삭제 성공 여부("OK" or "NO" or Exception.Message)

      • [1] : 삭제된 파일명

GetData

  • 파일 첨부 번호에 대한 첨부 정보를 반환

  • Parameters

    • string attdatnum : 파일 첨부 번호

  • Returns

    • DataTable : 전달 받은 첨부 번호(attdatnum)에 대한 조회 결과

SaveAndUpload

  • 클라이언트 파일 경로를 읽고, 첨부 번호에 대한 데이터 처리 후 서버에 파일 업로드

  • Parameters

    • string[] filePaths : 업로드할 파일의 경로 (클라이언트 기준의 파일 FullName)

    • ref string attdatnum : 파일 첨부 번호 (이미 생성된 첨부 번호에 파일을 추가하려면 유효한 값을 전달하고, 새로운 첨부 번호를 생성하려면 빈 값을 전달)

    • out string[] savedFileNames : 서버에 업로드된 파일명 (savenm 필드의 값, 전달한 클라이언트 파일 경로 개수만큼 반환)

  • Returns

    • bool : 정상 처리 여부

DeleteAttachments

  • 파일 첨부 번호로 등록된 첨부 정보와 서버에서 파일을 제거

  • Parameters

    • string attdatnum : 파일 첨부 번호

  • Returns

    • bool : 정상 처리 여부

GetServerDateTime

  • WAS(Web Application Server)의 일시(DateTime)를 반환

  • Returns

    • DateTime : 현재 일시

Setting

어셈블리 참조

  • GST.IoT.Library.dll : 따로 다운로드 필요

  • GST.Platform.Client.Library.dll : GSTBrowser가 설치된 폴더 내 위치 (기본 경로: C:\GSTBrowser)

  • GST.Platform.ServiceInterface.dll : GSTBrowser가 설치된 폴더 내 위치 (기본 경로: C:\GSTBrowser)

ServiceInterface 타입의 객체를 필드 멤버로 정의

Example 1 - 파일 다운로드

  • 다음과 같이 저장된 첨부 정보를 예시로 작성된 코드이며, 리터널로 처리된 부분은 프로그램 컨셉에 따라 적절하게 응용 필요

Example 2 - 파일 업로드

  • 하나 이상의 파일을 선택하여 DB에 첨부 정보를 저장함과 동시에 서버에 파일을 업로드하고, 그 결과를 MessageBox를 통해 출력하는 예시

  • SaveAndUpload 메서드의 결과(첨부번호:attdatnum, 저장파일명:savedFileNames)를 필요에 의해 응용하여 프로그램 개발할 것

결과

배포

Last updated

Was this helpful?