001package jmri.jmrix.pi.simulator; 002 003import com.pi4j.io.gpio.*; 004import com.pi4j.io.gpio.event.GpioPinListener; 005import com.pi4j.io.gpio.trigger.GpioTrigger; 006 007import java.util.Collection; 008 009/** 010 * Simulate Raspberry Pi GPIO 011 * 012 * @author Daniel Bergqvist Copyright (C) 2022 013 */ 014public class GpioSimulator implements GpioController { 015 016 private static GpioSimulator instance = new GpioSimulator(); 017 018 public static GpioSimulator getInstance() { 019 return instance; 020 } 021 022 private GpioSimulator() { 023 } 024 025 @Override 026 public void export(PinMode pm, PinState ps, GpioPin... gps) { 027 throw new UnsupportedOperationException("Not supported"); 028 } 029 030 @Override 031 public void export(PinMode pm, GpioPin... gps) { 032 throw new UnsupportedOperationException("Not supported"); 033 } 034 035 @Override 036 public boolean isExported(GpioPin... gps) { 037 throw new UnsupportedOperationException("Not supported"); 038 } 039 040 @Override 041 public void unexport(Pin... pins) { 042 throw new UnsupportedOperationException("Not supported"); 043 } 044 045 @Override 046 public void unexport(GpioPin... gps) { 047 throw new UnsupportedOperationException("Not supported"); 048 } 049 050 @Override 051 public void unexportAll() { 052 throw new UnsupportedOperationException("Not supported"); 053 } 054 055 @Override 056 public void setMode(PinMode pm, GpioPin... gps) { 057 throw new UnsupportedOperationException("Not supported"); 058 } 059 060 @Override 061 public PinMode getMode(GpioPin gp) { 062 throw new UnsupportedOperationException("Not supported"); 063 } 064 065 @Override 066 public boolean isMode(PinMode pm, GpioPin... gps) { 067 throw new UnsupportedOperationException("Not supported"); 068 } 069 070 @Override 071 public void setPullResistance(PinPullResistance ppr, GpioPin... gps) { 072 throw new UnsupportedOperationException("Not supported"); 073 } 074 075 @Override 076 public PinPullResistance getPullResistance(GpioPin gp) { 077 throw new UnsupportedOperationException("Not supported"); 078 } 079 080 @Override 081 public boolean isPullResistance(PinPullResistance ppr, GpioPin... gps) { 082 throw new UnsupportedOperationException("Not supported"); 083 } 084 085 @Override 086 public void high(GpioPinDigitalOutput... gpdos) { 087 throw new UnsupportedOperationException("Not supported"); 088 } 089 090 @Override 091 public boolean isHigh(GpioPinDigital... gpds) { 092 throw new UnsupportedOperationException("Not supported"); 093 } 094 095 @Override 096 public void low(GpioPinDigitalOutput... gpdos) { 097 throw new UnsupportedOperationException("Not supported"); 098 } 099 100 @Override 101 public boolean isLow(GpioPinDigital... gpds) { 102 throw new UnsupportedOperationException("Not supported"); 103 } 104 105 @Override 106 public void setState(PinState ps, GpioPinDigitalOutput... gpdos) { 107 throw new UnsupportedOperationException("Not supported"); 108 } 109 110 @Override 111 public void setState(boolean bln, GpioPinDigitalOutput... gpdos) { 112 throw new UnsupportedOperationException("Not supported"); 113 } 114 115 @Override 116 public boolean isState(PinState ps, GpioPinDigital... gpds) { 117 throw new UnsupportedOperationException("Not supported"); 118 } 119 120 @Override 121 public PinState getState(GpioPinDigital gpd) { 122 throw new UnsupportedOperationException("Not supported"); 123 } 124 125 @Override 126 public void toggle(GpioPinDigitalOutput... gpdos) { 127 throw new UnsupportedOperationException("Not supported"); 128 } 129 130 @Override 131 public void pulse(long l, GpioPinDigitalOutput... gpdos) { 132 throw new UnsupportedOperationException("Not supported"); 133 } 134 135 @Override 136 public void setValue(double d, GpioPinAnalogOutput... gpaos) { 137 throw new UnsupportedOperationException("Not supported"); 138 } 139 140 @Override 141 public double getValue(GpioPinAnalog gpa) { 142 throw new UnsupportedOperationException("Not supported"); 143 } 144 145 @Override 146 public void addListener(GpioPinListener gl, GpioPinInput... gpis) { 147 throw new UnsupportedOperationException("Not supported"); 148 } 149 150 @Override 151 public void addListener(GpioPinListener[] gls, GpioPinInput... gpis) { 152 throw new UnsupportedOperationException("Not supported"); 153 } 154 155 @Override 156 public void removeListener(GpioPinListener gl, GpioPinInput... gpis) { 157 throw new UnsupportedOperationException("Not supported"); 158 } 159 160 @Override 161 public void removeListener(GpioPinListener[] gls, GpioPinInput... gpis) { 162 throw new UnsupportedOperationException("Not supported"); 163 } 164 165 @Override 166 public void removeAllListeners() { 167 throw new UnsupportedOperationException("Not supported"); 168 } 169 170 @Override 171 public void addTrigger(GpioTrigger gt, GpioPinInput... gpis) { 172 throw new UnsupportedOperationException("Not supported"); 173 } 174 175 @Override 176 public void addTrigger(GpioTrigger[] gts, GpioPinInput... gpis) { 177 throw new UnsupportedOperationException("Not supported"); 178 } 179 180 @Override 181 public void removeTrigger(GpioTrigger gt, GpioPinInput... gpis) { 182 throw new UnsupportedOperationException("Not supported"); 183 } 184 185 @Override 186 public void removeTrigger(GpioTrigger[] gts, GpioPinInput... gpis) { 187 throw new UnsupportedOperationException("Not supported"); 188 } 189 190 @Override 191 public void removeAllTriggers() { 192 throw new UnsupportedOperationException("Not supported"); 193 } 194 195 @Override 196 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider gp, Pin pin, String string, PinMode pm, PinPullResistance ppr) { 197 throw new UnsupportedOperationException("Not supported"); 198 } 199 200 @Override 201 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider gp, Pin pin, PinMode pm, PinPullResistance ppr) { 202 throw new UnsupportedOperationException("Not supported"); 203 } 204 205 @Override 206 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider gp, Pin pin, String string, PinMode pm) { 207 throw new UnsupportedOperationException("Not supported"); 208 } 209 210 @Override 211 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider gp, Pin pin, PinMode pm) { 212 throw new UnsupportedOperationException("Not supported"); 213 } 214 215 @Override 216 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, String string, PinMode pm, PinPullResistance ppr) { 217 throw new UnsupportedOperationException("Not supported"); 218 } 219 220 @Override 221 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, PinMode pm, PinPullResistance ppr) { 222 throw new UnsupportedOperationException("Not supported"); 223 } 224 225 @Override 226 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, String string, PinMode pm) { 227 throw new UnsupportedOperationException("Not supported"); 228 } 229 230 @Override 231 public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, PinMode pm) { 232 throw new UnsupportedOperationException("Not supported"); 233 } 234 235 @Override 236 public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider gp, Pin pin, String string, PinPullResistance ppr) { 237 throw new UnsupportedOperationException("Not supported"); 238 } 239 240 @Override 241 public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider gp, Pin pin, PinPullResistance ppr) { 242 throw new UnsupportedOperationException("Not supported"); 243 } 244 245 @Override 246 public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider gp, Pin pin, String string) { 247 throw new UnsupportedOperationException("Not supported"); 248 } 249 250 @Override 251 public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider gp, Pin pin) { 252 throw new UnsupportedOperationException("Not supported"); 253 } 254 255 @Override 256 public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, String string, PinPullResistance ppr) { 257 return new GpioPinDigitalInputSimulator(pin, string, ppr); 258 } 259 260 @Override 261 public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, PinPullResistance ppr) { 262 throw new UnsupportedOperationException("Not supported"); 263 } 264 265 @Override 266 public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, String string) { 267 throw new UnsupportedOperationException("Not supported"); 268 } 269 270 @Override 271 public GpioPinDigitalInput provisionDigitalInputPin(Pin pin) { 272 throw new UnsupportedOperationException("Not supported"); 273 } 274 275 @Override 276 public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider gp, Pin pin, String string, PinState ps) { 277 throw new UnsupportedOperationException("Not supported"); 278 } 279 280 @Override 281 public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider gp, Pin pin, PinState ps) { 282 throw new UnsupportedOperationException("Not supported"); 283 } 284 285 @Override 286 public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider gp, Pin pin, String string) { 287 throw new UnsupportedOperationException("Not supported"); 288 } 289 290 @Override 291 public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider gp, Pin pin) { 292 throw new UnsupportedOperationException("Not supported"); 293 } 294 295 @Override 296 public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, String string, PinState ps) { 297 throw new UnsupportedOperationException("Not supported"); 298 } 299 300 @Override 301 public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, PinState ps) { 302 throw new UnsupportedOperationException("Not supported"); 303 } 304 305 @Override 306 public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, String string) { 307 return new GpioPinDigitalOutputSimulator(pin, string); 308 } 309 310 @Override 311 public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin) { 312 throw new UnsupportedOperationException("Not supported"); 313 } 314 315 @Override 316 public GpioPinAnalogInput provisionAnalogInputPin(GpioProvider gp, Pin pin, String string) { 317 throw new UnsupportedOperationException("Not supported"); 318 } 319 320 @Override 321 public GpioPinAnalogInput provisionAnalogInputPin(GpioProvider gp, Pin pin) { 322 throw new UnsupportedOperationException("Not supported"); 323 } 324 325 @Override 326 public GpioPinAnalogInput provisionAnalogInputPin(Pin pin, String string) { 327 throw new UnsupportedOperationException("Not supported"); 328 } 329 330 @Override 331 public GpioPinAnalogInput provisionAnalogInputPin(Pin pin) { 332 throw new UnsupportedOperationException("Not supported"); 333 } 334 335 @Override 336 public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider gp, Pin pin, String string, double d) { 337 throw new UnsupportedOperationException("Not supported"); 338 } 339 340 @Override 341 public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider gp, Pin pin, double d) { 342 throw new UnsupportedOperationException("Not supported"); 343 } 344 345 @Override 346 public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider gp, Pin pin, String string) { 347 throw new UnsupportedOperationException("Not supported"); 348 } 349 350 @Override 351 public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider gp, Pin pin) { 352 throw new UnsupportedOperationException("Not supported"); 353 } 354 355 @Override 356 public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, String string, double d) { 357 throw new UnsupportedOperationException("Not supported"); 358 } 359 360 @Override 361 public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, double d) { 362 throw new UnsupportedOperationException("Not supported"); 363 } 364 365 @Override 366 public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, String string) { 367 throw new UnsupportedOperationException("Not supported"); 368 } 369 370 @Override 371 public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin) { 372 throw new UnsupportedOperationException("Not supported"); 373 } 374 375 @Override 376 public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider gp, Pin pin, String string, int i) { 377 throw new UnsupportedOperationException("Not supported"); 378 } 379 380 @Override 381 public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider gp, Pin pin, int i) { 382 throw new UnsupportedOperationException("Not supported"); 383 } 384 385 @Override 386 public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider gp, Pin pin, String string) { 387 throw new UnsupportedOperationException("Not supported"); 388 } 389 390 @Override 391 public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider gp, Pin pin) { 392 throw new UnsupportedOperationException("Not supported"); 393 } 394 395 @Override 396 public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, String string, int i) { 397 throw new UnsupportedOperationException("Not supported"); 398 } 399 400 @Override 401 public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, int i) { 402 throw new UnsupportedOperationException("Not supported"); 403 } 404 405 @Override 406 public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, String string) { 407 throw new UnsupportedOperationException("Not supported"); 408 } 409 410 @Override 411 public GpioPinPwmOutput provisionPwmOutputPin(Pin pin) { 412 throw new UnsupportedOperationException("Not supported"); 413 } 414 415 @Override 416 public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider gp, Pin pin, String string, int i) { 417 throw new UnsupportedOperationException("Not supported"); 418 } 419 420 @Override 421 public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider gp, Pin pin, int i) { 422 throw new UnsupportedOperationException("Not supported"); 423 } 424 425 @Override 426 public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider gp, Pin pin, String string) { 427 throw new UnsupportedOperationException("Not supported"); 428 } 429 430 @Override 431 public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider gp, Pin pin) { 432 throw new UnsupportedOperationException("Not supported"); 433 } 434 435 @Override 436 public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, String string, int i) { 437 throw new UnsupportedOperationException("Not supported"); 438 } 439 440 @Override 441 public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, int i) { 442 throw new UnsupportedOperationException("Not supported"); 443 } 444 445 @Override 446 public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, String string) { 447 throw new UnsupportedOperationException("Not supported"); 448 } 449 450 @Override 451 public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin) { 452 throw new UnsupportedOperationException("Not supported"); 453 } 454 455 @Override 456 public GpioPin provisionPin(GpioProvider gp, Pin pin, String string, PinMode pm, PinState ps) { 457 throw new UnsupportedOperationException("Not supported"); 458 } 459 460 @Override 461 public GpioPin provisionPin(GpioProvider gp, Pin pin, String string, PinMode pm) { 462 throw new UnsupportedOperationException("Not supported"); 463 } 464 465 @Override 466 public GpioPin provisionPin(GpioProvider gp, Pin pin, PinMode pm) { 467 throw new UnsupportedOperationException("Not supported"); 468 } 469 470 @Override 471 public GpioPin provisionPin(Pin pin, String string, PinMode pm) { 472 throw new UnsupportedOperationException("Not supported"); 473 } 474 475 @Override 476 public GpioPin provisionPin(Pin pin, PinMode pm) { 477 throw new UnsupportedOperationException("Not supported"); 478 } 479 480 @Override 481 public void setShutdownOptions(GpioPinShutdown gps, GpioPin... gps1) { 482 throw new UnsupportedOperationException("Not supported"); 483 } 484 485 @Override 486 public void setShutdownOptions(Boolean bln, GpioPin... gps) { 487 throw new UnsupportedOperationException("Not supported"); 488 } 489 490 @Override 491 public void setShutdownOptions(Boolean bln, PinState ps, GpioPin... gps) { 492 throw new UnsupportedOperationException("Not supported"); 493 } 494 495 @Override 496 public void setShutdownOptions(Boolean bln, PinState ps, PinPullResistance ppr, GpioPin... gps) { 497 throw new UnsupportedOperationException("Not supported"); 498 } 499 500 @Override 501 public void setShutdownOptions(Boolean bln, PinState ps, PinPullResistance ppr, PinMode pm, GpioPin... gps) { 502 throw new UnsupportedOperationException("Not supported"); 503 } 504 505 @Override 506 public Collection<GpioPin> getProvisionedPins() { 507 throw new UnsupportedOperationException("Not supported"); 508 } 509 510 @Override 511 public GpioPin getProvisionedPin(Pin pin) { 512 throw new UnsupportedOperationException("Not supported"); 513 } 514 515 @Override 516 public GpioPin getProvisionedPin(String string) { 517 throw new UnsupportedOperationException("Not supported"); 518 } 519 520 @Override 521 public void unprovisionPin(GpioPin... gps) { 522 throw new UnsupportedOperationException("Not supported"); 523 } 524 525 @Override 526 public boolean isShutdown() { 527 throw new UnsupportedOperationException("Not supported"); 528 } 529 530 @Override 531 public void shutdown() { 532 throw new UnsupportedOperationException("Not supported"); 533 } 534 535}